mirror of
https://github.com/nodejs/node.git
synced 2025-04-29 14:25:18 +00:00

PR-URL: https://github.com/nodejs/node/pull/31995 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
21 lines
522 B
JavaScript
21 lines
522 B
JavaScript
'use strict';
|
|
// Flags: --expose_gc
|
|
|
|
// This test ensures that AsyncLocalStorage gets gced once it was disabled
|
|
// and no strong references remain in userland.
|
|
|
|
const common = require('../common');
|
|
const { AsyncLocalStorage } = require('async_hooks');
|
|
const onGC = require('../common/ongc');
|
|
|
|
let asyncLocalStorage = new AsyncLocalStorage();
|
|
|
|
asyncLocalStorage.runSyncAndReturn({}, () => {
|
|
asyncLocalStorage.disable();
|
|
|
|
onGC(asyncLocalStorage, { ongc: common.mustCall() });
|
|
});
|
|
|
|
asyncLocalStorage = null;
|
|
global.gc();
|