mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 11:41:22 +00:00

Co-authored-by: Luigi Pinca <luigipinca@gmail.com> PR-URL: https://github.com/nodejs/node/pull/48611 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
25 lines
598 B
JavaScript
25 lines
598 B
JavaScript
'use strict';
|
|
|
|
// Flags: --expose-gc
|
|
|
|
// Check that creating a server without listening does not leak resources.
|
|
|
|
require('../common');
|
|
const onGC = require('../common/ongc');
|
|
const Countdown = require('../common/countdown');
|
|
|
|
const http = require('http');
|
|
const max = 100;
|
|
|
|
// Note that Countdown internally calls common.mustCall, that's why it's not done here.
|
|
const countdown = new Countdown(max, () => {});
|
|
|
|
for (let i = 0; i < max; i++) {
|
|
const server = http.createServer((req, res) => {});
|
|
onGC(server, { ongc: countdown.dec.bind(countdown) });
|
|
}
|
|
|
|
setImmediate(() => {
|
|
global.gc();
|
|
});
|