UNPKG

@metamask/ocap-kernel

Version:
24 lines 1.01 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.engineGC = void 0; const v8_1 = __importDefault(require("v8")); const vm_1 = __importDefault(require("vm")); /* global globalThis */ let bestGC = globalThis.gc; if (typeof bestGC !== 'function') { // Node.js v8 wizardry. v8_1.default.setFlagsFromString('--expose_gc'); bestGC = vm_1.default.runInNewContext('gc'); assert(bestGC); // We leave --expose_gc turned on, otherwise AVA's shared workers // may race and disable it before we manage to extract the // binding. This won't cause 'gc' to be visible to new Compartments // because SES strips out everything it doesn't recognize. // // Hide the gc global from new contexts/workers. // v8.setFlagsFromString('--no-expose_gc'); } exports.engineGC = bestGC; //# sourceMappingURL=gc-engine.cjs.map