xref: /third_party/node/test/async-hooks/test-async-local-storage-gcable.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/async-hooks/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci// Flags: --expose_gc
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_ci// This test ensures that AsyncLocalStorage gets gced once it was disabled
51cb0ef41Sopenharmony_ci// and no strong references remain in userland.
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst common = require('../common');
81cb0ef41Sopenharmony_ciconst { AsyncLocalStorage } = require('async_hooks');
91cb0ef41Sopenharmony_ciconst onGC = require('../common/ongc');
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_cilet asyncLocalStorage = new AsyncLocalStorage();
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciasyncLocalStorage.run({}, () => {
141cb0ef41Sopenharmony_ci  asyncLocalStorage.disable();
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci  onGC(asyncLocalStorage, { ongc: common.mustCall() });
171cb0ef41Sopenharmony_ci});
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ciasyncLocalStorage = null;
201cb0ef41Sopenharmony_ciglobal.gc();
21

Indexes created Thu Nov 07 10:32:03 CST 2024