1'use strict'; 2// Flags: --expose-gc --no-concurrent-array-buffer-sweeping 3require('../common'); 4const assert = require('assert'); 5const zlib = require('zlib'); 6 7// Tests that native zlib handles start out their life as weak handles. 8 9global.gc(); 10const before = process.memoryUsage().external; 11for (let i = 0; i < 100; ++i) 12 zlib.createGzip(); 13const afterCreation = process.memoryUsage().external; 14global.gc(); 15const afterGC = process.memoryUsage().external; 16 17assert((afterGC - before) / (afterCreation - before) <= 0.05, 18 `Expected after-GC delta ${afterGC - before} to be less than 5 %` + 19 ` of before-GC delta ${afterCreation - before}`); 20