5

I'm using htmlunit (version 2.15); I noticed a memory leak issue with the WebClient class: all webClient instances are not cleaned by garbage collector.

The issue seems caused by threads deadlock:

JavaScriptExecutor.run(JavaScriptExecutor.java:182)

I tried to call webclient.closeAllWindows for each instance but doesn't work.
I'm sure that ALL references to webClient objects are deallocated.

How can i properly clean the memory from webClient objects to avoid OOM? Garbage collector can't delete webClient objects due to thread lock.
I googled for hours but I don't find any working solution.
Thanks.

Azincourt
  • 935
  • 5
  • 13
  • 29
  • 1
    This looks a bit different than the issue I faced a while ago but maybe could shed some light: http://stackoverflow.com/questions/7200886 – Mosty Mostacho Jun 17 '14 at 15:41
  • 3
    I looked at this page [http://sourceforge.net/p/htmlunit/bugs/1259/](http://sourceforge.net/p/htmlunit/bugs/1259/). Seems they found a solution in a previous version, but still doesn't work.. – Azincourt Jun 17 '14 at 16:20

1 Answers1

2

I have discovered the same bug with 2.15 and created a reproducible test case that shows the issue to the developers. Hopefully they will address it quickly. You can see the bug and my test case here...

http://sourceforge.net/p/htmlunit/bugs/1638/

Melloware
  • 10,435
  • 2
  • 32
  • 62
  • Just a note the developers addressed the issue and I tested out there fix with from SVN SNAPSHOT and it fixes the issue. – Melloware Nov 04 '14 at 13:34
  • As a final followup HTMLUnit 2.16 with this bug fix is officially release on April, 20, 2015 – Melloware Apr 26 '15 at 13:01