[prev in list] [next in list] [prev in thread] [next in thread] 

List:       htmlunit-user
Subject:    Re: [Htmlunit-user] Memory leak from thread local variables?
From:       Cormac Redmond <credmond85 () gmail ! com>
Date:       2010-10-27 19:36:11
Message-ID: AANLkTikiMdkVPA0h0p6HTp8+pQBDH5dhdwhhJTnuFA-H () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I agree...I think there is a memory leak, but it's been a couple of weeks
since I noticed it. If I reproduce, I will provide more information...

On 27 October 2010 20:29, Carl Schmidt <carl@unbounce.com> wrote:

> Hey everyone!
>
> We use HtmlUnit to render out pages from our browser-based editing tool.
>  The page rendering relies heavily on Javascript, and we've noticed some
> memory leak issues related to HtmlUnit.
>
> After spending some time profiling/testing, it seemed to me that thread
> local variables (ScriptableObject) instances weren't getting cleaned up.  In
> one case, I had a unit test that failed with an OutOfMemory error after 10
> iterations.  In our application, we run HtmlUnit in an app server, which
> uses a thread pool, so eventually we run out of heap in production as well.
>
> Our interim fix was to simply launch an isolated thread in which we
> manipulate WebClient, then discard the thread.  This seemed to allow the
> ScriptableObject instances to get GC'd.  Using this technique I was able to
> run my test case without exhausting the heap.
>
> Just thought I'd toss this out there in case it helped anyone else...
>
> Cheers!
>
>  - Carl
>
>
>
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America
> contest
> Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in
> marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev
> _______________________________________________
> Htmlunit-user mailing list
> Htmlunit-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/htmlunit-user
>
>

[Attachment #5 (text/html)]

I agree...I think there is a memory leak, but it&#39;s been a couple of weeks since I \
noticed it. If I reproduce, I will provide more information...<br><br><div \
class="gmail_quote">On 27 October 2010 20:29, Carl Schmidt <span dir="ltr">&lt;<a \
href="mailto:carl@unbounce.com">carl@unbounce.com</a>&gt;</span> wrote:<br> \
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px \
solid rgb(204, 204, 204); padding-left: 1ex;">Hey everyone!<div><br></div><div>We use \
HtmlUnit to render out pages from our browser-based editing tool.  The page rendering \
relies heavily on Javascript, and we&#39;ve noticed some memory leak issues related \
to HtmlUnit.</div>


<div><br></div><div>After spending some time profiling/testing, it seemed to me that \
thread local variables (ScriptableObject) instances weren&#39;t getting cleaned up.  \
In one case, I had a unit test that failed with an OutOfMemory error after 10 \
iterations.  In our application, we run HtmlUnit in an app server, which uses a \
thread pool, so eventually we run out of heap in production as well.</div>


<div><br></div><div>Our interim fix was to simply launch an isolated thread in which \
we manipulate WebClient, then discard the thread.  This seemed to allow the \
ScriptableObject instances to get GC&#39;d.  Using this technique I was able to run \
my test case without exhausting the heap.</div>


<div><br></div><div>Just thought I&#39;d toss this out there in case it helped anyone \
else...</div><div><br></div><div>Cheers!</div><div><br></div><font \
color="#888888"><div> - Carl</div><div><br></div><div><br></div> \
</font><br>------------------------------------------------------------------------------<br>
 Nokia and AT&amp;T present the 2010 Calling All Innovators-North America contest<br>
Create new apps &amp; games for the Nokia N8 for consumers in  U.S. and Canada<br>
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing<br>
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store<br>
<a href="http://p.sf.net/sfu/nokia-dev2dev" \
target="_blank">http://p.sf.net/sfu/nokia-dev2dev</a><br>_______________________________________________<br>
 Htmlunit-user mailing list<br>
<a href="mailto:Htmlunit-user@lists.sourceforge.net">Htmlunit-user@lists.sourceforge.net</a><br>
 <a href="https://lists.sourceforge.net/lists/listinfo/htmlunit-user" \
target="_blank">https://lists.sourceforge.net/lists/listinfo/htmlunit-user</a><br> \
<br></blockquote></div><br>



------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev

_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-user


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic