mirror of
https://github.com/nodejs/node.git
synced 2025-08-17 06:38:47 +02:00

PR-URL: https://github.com/nodejs/node/pull/53337 Fixes: https://github.com/nodejs/node/issues/53335 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Feng Yu <F3n67u@outlook.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
23 lines
436 B
JavaScript
23 lines
436 B
JavaScript
'use strict';
|
|
// Flags: --expose-gc
|
|
require('../common');
|
|
const onGC = require('../common/ongc');
|
|
|
|
// See https://github.com/nodejs/node/issues/53335
|
|
const poller = setInterval(() => {
|
|
global.gc();
|
|
}, 100);
|
|
|
|
let count = 0;
|
|
|
|
for (let i = 0; i < 10; i++) {
|
|
const timer = setTimeout(() => {}, 0);
|
|
onGC(timer, {
|
|
ongc: () => {
|
|
if (++count === 10) {
|
|
clearInterval(poller);
|
|
}
|
|
}
|
|
});
|
|
console.log(+timer);
|
|
}
|