I found one thing in jsdom that I think of that it's a (at least
potential) memory leak:
https://github.com/tmpvar/jsdom/blob/master/lib/jsdom.js#L182
var
window = exports.html(html, null, {
features : {
'FetchExternalResources' : false,
'ProcessExternalResources' : false
}
}).createWindow(),
features = window.document.implementation._features,
docsLoaded = 0,
totalDocs = config.scripts.length;
readyState = null,
errors = null;
The semicolon in "totalDocs = config.scripts.length;" has to be a
comma, right?
--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.
If you want to free your application from Jsdom's heaviness, best way
is to use worker processes. If you're scraping a lot, you can use my
lib https://github.com/stagas/jjw that does this exact thing for you.
Each action will run a worker process, execute some predefined jquery
tasks, callback the results and die. So no matters how much it's
blocking or leaking, your app will never know.
-stagas
2011/5/16 Kim <operon...@gmail.com>:
Taken from one of the tests for jsdom:
var jQueryFile = __dirname + "/../../example/jquery/jquery.js";
<snip/>
jsdom.jQueryify(tmpWindow(), jQueryFile, testFunction);
So absolute path _should_ work.
Have you tried the code with a URL? - jsdom appends jsquery to the
document body, so it may be that your DOM is not valid (e.g. in your
pastings <HEAD><BODY> is not valid), try using: var doc =
jsdom.jsdom(); instead (with no parameters), which should
automatically create the document for you.
HTH,
Matt