node/test/node-api/test_env_teardown_gc/test.js
Gabriel Schulhof 52f9aafeab node-api: stop ref gc during environment teardown
A gc may happen during environment teardown. Thus, during finalization
initiated by environment teardown we must remove the V8 finalizer
before calling the Node-API finalizer.

Fixes: https://github.com/nodejs/node/issues/37236
PR-URL: https://github.com/nodejs/node/pull/37616
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2021-03-18 20:40:59 -07:00

15 lines
284 B
JavaScript

'use strict';
// Flags: --expose-gc
process.env.NODE_TEST_KNOWN_GLOBALS = 0;
const common = require('../../common');
const binding = require(`./build/${common.buildType}/binding`);
global.it = new binding.MyObject();
global.cleanup = () => {
delete global.it;
global.gc();
};