jsdom memory leak? #122

jedahan opened this Issue Oct 5, 2012 · 3 comments


None yet
2 participants

jedahan commented Oct 5, 2012

With jsdom: true memory usage balloons to 1.4gb very quickly. By switching doing $ = cheerio.load data memory usage still goes up but at a much much lower rate. Maybe consider supporting cheerio.
My code is https://gist.github.com/3841073 , so its probably my fault, but I am having trouble profiling so I'm not sure where my memory leak is.

jedahan commented Oct 5, 2012

I tried adding this.window.close() as per instruction in chriso#62 before my @emit but that did not fix the memory leak.

jedahan commented Oct 10, 2012

using cheerio, the memory leak is gone.
so maybe remove support for jsdom, or figure out where to do window.close()? I had trouble figuring out where to do that.


chriso commented Oct 14, 2012

Not sure what advice to give here. All of the created objects related to jsdom are exposed to the run() method so you'll need to look through it's documentation to find out how to reduce memory usage. jsdom is a bit of a memory hog from what I've heard - this is why it's not enabled by default. It does serve a purpose though - executing client-side JS and getting access to a proper selector engine (jQuery/sizzle) - so I don't plan on removing it.

Using cheerio has already been suggested (#103) and is TODO.

@chriso chriso closed this Oct 14, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment