mirror of
https://github.com/nodejs/node.git
synced 2024-11-27 22:16:50 +01:00
0b6b2a4dc7
PR-URL: https://github.com/nodejs/node/pull/54355 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
21 lines
511 B
JavaScript
21 lines
511 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/gc');
|
|
|
|
let asyncLocalStorage = new AsyncLocalStorage();
|
|
|
|
asyncLocalStorage.run({}, () => {
|
|
asyncLocalStorage.disable();
|
|
|
|
onGC(asyncLocalStorage, { ongc: common.mustCall() });
|
|
});
|
|
|
|
asyncLocalStorage = null;
|
|
global.gc();
|