Skip to content

Commit

Permalink
🔒️ fix isolate object leak
Browse files Browse the repository at this point in the history
DEV-389
  • Loading branch information
o4kapuk committed Dec 28, 2023
1 parent c8d9783 commit 4851481
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/runtime/runtime-driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ exports.evalCode = function(module, globals, returnValue, timeout, scriptCachedD

if(returnValue) {
var code = '(function(code,module,exports) { return "" + eval(code); })(' + JSON.stringify(module.code) + ', __module, __module.exports)';
result = runtime.isolate.compileScriptSync(code, options).runSync(runtime.context, options);
result = runtime.compileScriptSync(code, options).runSync(runtime.context, options);
}
else {

Expand All @@ -66,7 +66,7 @@ exports.evalCode = function(module, globals, returnValue, timeout, scriptCachedD

var code = '(function __module(module,exports){ ' + module.code + "\n})(__module, __module.exports)";

var script = runtime.isolate.compileScriptSync(code, options);
var script = runtime.compileScriptSync(code, options);

// if(scriptCachedData) {
// if(script.cachedDataProduced) {
Expand Down
6 changes: 4 additions & 2 deletions lib/runtime/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ global._init = (function() {
return isolate.cpuTime[0] * 1e3 + isolate.cpuTime[1] / 1e6;
}

module.exports.isolate = isolate;
module.exports.context = context;
module.exports.compileScriptSync = function(code, options) {
return isolate.compileScriptSync(code, options);
}

_.each(customObjectPrototypes, cop => {
_.each(cop.opts.properties, (fn, key) => {
Expand All @@ -52,7 +54,7 @@ global._init = (function() {

global._start = function (data) {
Object.setPrototypeOf(data, null);

let activeSegments, publicSegments, defaultPublicSegment, activeForeignSegment;
let startTime, startDirtyTime = nowCpuTime();
let intentCpu = 0.2,
Expand Down

0 comments on commit 4851481

Please sign in to comment.