| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3c8daa3 commit 1539928
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -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(); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments