mirror of
https://github.com/nodejs/node.git
synced 2025-05-20 22:32:40 +00:00

Ref: https://chromium-review.googlesource.com/c/v8/v8/+/1997438 Ref: https://chromium-review.googlesource.com/c/v8/v8/+/2010107 Ref: https://github.com/nodejs/node-v8/issues/144 Signed-off-by: Matheus Marchini <mmarchini@netflix.com> PR-URL: https://github.com/nodejs/node/pull/32831 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
19 lines
642 B
JavaScript
19 lines
642 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.
|
|
|
|
const before = process.memoryUsage().external;
|
|
for (let i = 0; i < 100; ++i)
|
|
zlib.createGzip();
|
|
const afterCreation = process.memoryUsage().external;
|
|
global.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}`);
|