Can context be broken?

A memory leak occurs in Node.JS or V8, which removes my ability to reuse the process to jqueryify many HTML pages.

Error here: https://github.com/joyent/node/issues/1007

The error, meanwhile, is it possible to โ€œdestroyโ€ the context when I finished with it? Seams like this can make a simple hack for jsdom code, so I can move my own code logically without writing reloads.

We have a way to keep track of our companyโ€™s own settings for open source projects so that we can bring updates and still fix bugs that we could find without waiting for the Open Source community.

If I can destroy the context, I think I will be good to go.

tmpvar in jsdom says this is a Node.JS problem and I donโ€™t know when it will be fixed because see that it is months and there are already many open problems https://github.com/joyent/node/issues / 637 .

+5
source share
1 answer

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

vm.runInNewContext can be useful as you access the returned context on your own.

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));
+1
source

All Articles