Bugs item #1756623, was opened at 2007-07-19 16:18
Message generated for change (Tracker Item Submitted) made by Item Submitter
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 1.4.1
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Matt Ryall (mryall)
Assigned to: Nobody/Anonymous (nobody)
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.

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

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 DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
JWebUnit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to