%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
// Flags: --expose-gc 'use strict'; const common = require('../common'); if (process.config.variables.asan) { common.skip('ASAN messes with memory measurements'); } if (common.isPi) { common.skip('Too slow for Raspberry Pi devices'); } const assert = require('assert'); const net = require('net'); // Tests that, when receiving small chunks, we do not keep the full length // of the original allocation for the libuv read call in memory. let client; let baseRSS; const receivedChunks = []; const N = 250000; const server = net.createServer(common.mustCall((socket) => { baseRSS = process.memoryUsage.rss(); socket.setNoDelay(true); socket.on('data', (chunk) => { receivedChunks.push(chunk); if (receivedChunks.length < N) { client.write('a'); } else { client.end(); server.close(); } }); })).listen(0, common.mustCall(() => { client = net.connect(server.address().port); client.setNoDelay(true); client.write('hello!'); })); process.on('exit', () => { global.gc(); const bytesPerChunk = (process.memoryUsage.rss() - baseRSS) / receivedChunks.length; // We should always have less than one page (usually ~ 4 kB) per chunk. assert(bytesPerChunk < 650, `measured ${bytesPerChunk} bytes per chunk`); });