mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
0b6b2a4dc7
PR-URL: https://github.com/nodejs/node/pull/54355 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
24 lines
438 B
JavaScript
24 lines
438 B
JavaScript
'use strict';
|
|
// Flags: --expose-gc
|
|
require('../common');
|
|
const { onGC } = require('../common/gc');
|
|
|
|
// 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);
|
|
}
|