[Webtest] Re: Memory issue (problem in htmlunit)
webtest@lists.canoo.com
webtest@lists.canoo.com
Tue, 18 Oct 2005 22:47:09 -0500 (CDT)
The problem we had with htmlunit turned out to be caused by our usage of
setTimeout in javascript.
What was happening is that we were using setTimeout to end the session, so
setTimeout was being called with an argument of 900000ms (15 minutes).
This meant that canoo test was being kept in memory for 15 minutes, even
though the test itself had long ago finished. This was why we were running
out of memory, as the tests themselves were never removed from memory.
We found a way around it, by setting the user-agent string in canoo
webtest to have the word canoo in it. Then when we call setTimeout, we
check the user agent string, and if canoo is there we make setTimeout to
250ms, instead of 900000ms. It's a bit of a hack but it works.