2020-02-26 07:38:48 +01:00
|
|
|
'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');
|
2024-08-13 12:28:21 +02:00
|
|
|
const { onGC } = require('../common/gc');
|
2020-02-26 07:38:48 +01:00
|
|
|
|
|
|
|
let asyncLocalStorage = new AsyncLocalStorage();
|
|
|
|
|
2020-03-14 07:06:06 +01:00
|
|
|
asyncLocalStorage.run({}, () => {
|
2020-02-26 07:38:48 +01:00
|
|
|
asyncLocalStorage.disable();
|
|
|
|
|
|
|
|
onGC(asyncLocalStorage, { ongc: common.mustCall() });
|
|
|
|
});
|
|
|
|
|
|
|
|
asyncLocalStorage = null;
|
|
|
|
global.gc();
|