Running the following code which just adds a script element ends up with residual objects in the heap (for example DomAttr). The number of these increases every run.
WebClient webClient = new WebClient(BrowserVersion.FIREFOX_3_6); webClient.setCssEnabled(true); webClient.setJavaScriptEnabled(false); WebRequest setting = new WebRequest(new URL("http://www.google.com")); final HtmlPage htmlPage = webClient.getPage(setting); NodeList list = htmlPage.getElementsByTagName("body"); HtmlElement bodyElement = (HtmlElement)list.item(0); HtmlElement scriptElement = (HtmlElement) htmlPage.createElement("script"); bodyElement.appendChild(scriptElement); webClient.closeAllWindows();
Diff:
Did some tests today; let your code run 10.000 times (more than 2h) with the current code from svn. There was no notable memory leak.
So the bug seems to be fixed by one of our last memory leak fixes.