5

Node.JS 或 V8 中存在内存泄漏,这使我无法重用进程来对许多 HTML 页面进行 jqueryify。

错误在这里:https ://github.com/joyent/node/issues/1007

与此同时,当我完成一个上下文时,是否有可能“破坏”它?像它这样的接缝可能会对 jsdom 代码进行简单的破解,因此我可以以逻辑方式编写自己的代码,而无需编写重新启动。

我们有办法跟踪我们公司自己对开源项目的调整,这样我们就可以引入更新并仍然修复我们可能发现的错误,而无需等待开源社区。

如果我可以破坏上下文,我想我会很好。

jsdom 的 tmpvar 说这是一个 Node.JS 问题,我不知道什么时候会修复,因为看到这是几个月前的问题,并且已经有很多未解决的问题https://github.com/joyent/node/issues/637 .

4

1 回答 1

1

The best way I can think of is to look at using the node VM stuff.

vm.runInNewContext might be of use as you get access to the returned context do with as you wish.

var util = require('util'),
    vm = require('vm'),
    sandbox = {
      animal: 'cat',
      count: 2
    };

vm.runInNewContext('count += 1; name = "kitty"', sandbox, 'myfile.vm');
console.log(util.inspect(sandbox));
于 2012-06-03T11:57:26.117 回答