Skip to content

Cleaning up memory leak without completely destroying the driver? #639

@skyhirider

Description

@skyhirider

I've been running HtmlUnit via Selenium in 16 threads for hours and noticed the memory is accumulating over time.

Destroying the driver is one solution I am looking into, but so far it seems like most of the leakage is from javascript.

Is there a clean way to purge a driver or HtmlUnit itself to close all active pages, terminating and cleaning up any related javascript objects as well?

The workaround is to remember when a driver was instantiated and if it has been alive for long enough, save the cookies, destroy the driver, spin up a new one and inject the cookies back. But that is a lot of work just to do cleanup.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions