1'use strict'; 2// Flags: --expose_gc 3 4// This test ensures that AsyncLocalStorage gets gced once it was disabled 5// and no strong references remain in userland. 6 7const common = require('../common'); 8const { AsyncLocalStorage } = require('async_hooks'); 9const onGC = require('../common/ongc'); 10 11let asyncLocalStorage = new AsyncLocalStorage(); 12 13asyncLocalStorage.run({}, () => { 14 asyncLocalStorage.disable(); 15 16 onGC(asyncLocalStorage, { ongc: common.mustCall() }); 17}); 18 19asyncLocalStorage = null; 20global.gc(); 21