Bugs item #1756623, was opened at 2007-07-19 08:18
Message generated for change (Comment added) made by henryju
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=1756623&group_id=61302

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: HtmlUnit plugin
>Group: Release 2.0
>Status: Closed
>Resolution: Remind
Priority: 5
Private: No
Submitted By: Matt Ryall (mryall)
>Assigned to: Julien HENRY (henryju)
Summary: HtmlUnitDialog triggers memory leak in HtmlUnit cache

Initial Comment:
JWebUnit's HtmlUnitDialog creates a new BrowserVersion instance every time 
initWebClient() is called. This triggers a memory leak in HtmlUnit, because 
each instance of BrowserVersion is cached in a static HashMap against the 
JavaScriptConfiguration which is created using it. Because BrowserVersion 
doesn't implement hashCode() or equals(), every new instance of 
JavaScriptConfiguration ends up in the static cache and is never removed.

The fix for the underlying problem is to add hashCode() and equals() to 
HtmlUnit's BrowserVersion class. I've raised a bug to get that fixed with the 
HtmlUnit guys:

https://sourceforge.net/support/tracker.php?aid=1756617

However, this is still a minor problem with JWebUnit's implementation of 
HtmlUnitDialog. JWebUnit should not create a new instance of BrowserVersion 
each time initWebClient() is called. This instance could be a constant on the 
HtmlUnitDialog class, since it never changes.

I've attached a test case which demonstrates the problem. It crashes a 64 MB 
JVM pretty quickly, and in our application acceptance testing it has brought 
down a 512 MB JVM.

----------------------------------------------------------------------

>Comment By: Julien HENRY (henryju)
Date: 2008-04-14 14:38

Message:
Logged In: YES 
user_id=1235926
Originator: NO

Thank you for pointing this issue. As it was fixed upstream by HtmlUnit
guys I will not change anything for now in JWebUnit code.
But I will keep this point in mind when I will refactor
HtmlUnitTestingEngine.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=1756623&group_id=61302

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
JWebUnit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to