mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 13:40:37 +00:00

PR-URL: https://github.com/nodejs/node/pull/56712 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
20 lines
663 B
JavaScript
20 lines
663 B
JavaScript
'use strict';
|
|
// Flags: --expose-gc --no-concurrent-array-buffer-sweeping
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const zlib = require('zlib');
|
|
|
|
// Tests that native zlib handles start out their life as weak handles.
|
|
|
|
globalThis.gc();
|
|
const before = process.memoryUsage().external;
|
|
for (let i = 0; i < 100; ++i)
|
|
zlib.createGzip();
|
|
const afterCreation = process.memoryUsage().external;
|
|
globalThis.gc();
|
|
const afterGC = process.memoryUsage().external;
|
|
|
|
assert((afterGC - before) / (afterCreation - before) <= 0.05,
|
|
`Expected after-GC delta ${afterGC - before} to be less than 5 %` +
|
|
` of before-GC delta ${afterCreation - before}`);
|