We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6bcea0a commit e4f1c18Copy full SHA for e4f1c18
test/async-hooks/test-async-local-storage-gcable.js
@@ -0,0 +1,20 @@
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
7
+const common = require('../common');
8
+const { AsyncLocalStorage } = require('async_hooks');
9
+const onGC = require('../common/ongc');
10
11
+let asyncLocalStorage = new AsyncLocalStorage();
12
13
+asyncLocalStorage.runSyncAndReturn({}, () => {
14
+ asyncLocalStorage.disable();
15
16
+ onGC(asyncLocalStorage, { ongc: common.mustCall() });
17
+});
18
19
+asyncLocalStorage = null;
20
+global.gc();
0 commit comments