Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: add GC test for disabled AsyncLocalStorage
PR-URL: #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>
  • Loading branch information
puzpuzpuz committed Apr 14, 2020
commit ecc59354f0257e2979f8b0cf3132ad010a1842f9
20 changes: 20 additions & 0 deletions test/async-hooks/test-async-local-storage-gcable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'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();