You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using latest 4.10.0 the plain vanilla code below leaks the above objects when running with Javascript enabled for longer periods of time. The silent error handler and exception suppression do not help. Memory leaked is about 200M / hour / JS executor. Different websites tried.
webClient = new WebClient(BrowserVersion.FIREFOX); page = webClient.getPage(url);
Hi, I am new to HtmlUnit, tried no older version.
I just load the page as described above. You can see in VisualVM, that the JS Executor goes high on CPU and memory allocation and Objects of type org.htmlunit.corejs.javascript.Arguments$ThrowTypeError leak.
Debugging this will require some time. But as a first step we might optimize Rhino a bit to reduce the number of objects created here (see my Rhino PR)
minor update, there is a intervall function that fails with an error - this happens over and over again (intervall), therefore i guess this might be part of the story
Does loading an empty page clean up the javascript assigned to it?
When I use HtmlUnit, I get a driver from a pool, do actions, load an empty page ( driver.get("data:text/html;charset=utf-8,empty" ) ) and return it to the pool.
Found its a good way to keep sessions on standby going crazy in the background.
for the records, the Arguments$ThrowTypeError handling got a major change in Rhino/core-js during the last releases. I do not expect this cures the problem but it is more spec complient in this field.
In one of my applications I see 18 objects after 6 hours uptime, so if they should not be there, currently it´s a very small problem at best. However this might change, if switching to other websites.
Activity
rbri commentedon Mar 14, 2025
Hi @jogger2510,
can you please provide some more details. You mean you open a page and then wait only to see the memory leak?
Is this new in 4.10 or a older problem?
Any chance to provide the url to let me reprouce?
jogger2510 commentedon Mar 14, 2025
Hi, I am new to HtmlUnit, tried no older version.
I just load the page as described above. You can see in VisualVM, that the JS Executor goes high on CPU and memory allocation and Objects of type org.htmlunit.corejs.javascript.Arguments$ThrowTypeError leak.
URL that leaks fastest in my setup: https://live.euronext.com/en/product/equities/SGXZ53070850-XOSL
rbri commentedon Mar 15, 2025
Debugging this will require some time. But as a first step we might optimize Rhino a bit to reduce the number of objects created here (see my Rhino PR)
rbri commentedon Mar 16, 2025
minor update, there is a intervall function that fails with an error - this happens over and over again (intervall), therefore i guess this might be part of the story
skyhirider commentedon Mar 16, 2025
Does loading an empty page clean up the javascript assigned to it?
When I use HtmlUnit, I get a driver from a pool, do actions, load an empty page ( driver.get("data:text/html;charset=utf-8,empty" ) ) and return it to the pool.
Found its a good way to keep sessions on standby going crazy in the background.
rbri commentedon Dec 1, 2025
for the records, the Arguments$ThrowTypeError handling got a major change in Rhino/core-js during the last releases. I do not expect this cures the problem but it is more spec complient in this field.
rbri commentedon Jun 30, 2026
@jogger2510 is this still a problem?
jogger2510 commentedon Jun 30, 2026
In one of my applications I see 18 objects after 6 hours uptime, so if they should not be there, currently it´s a very small problem at best. However this might change, if switching to other websites.