-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
Expand file tree
/
Copy pathtest-heapdump-zlib.js
More file actions
35 lines (30 loc) · 1.24 KB
/
test-heapdump-zlib.js
File metadata and controls
35 lines (30 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict';
// This tests heap snapshot integration of zlib stream.
const common = require('../common');
const assert = require('assert');
const { validateByRetainingPath, validateByRetainingPathFromNodes } = require('../common/heap');
const zlib = require('zlib');
// Before zlib stream is created, no ZlibStream should be created.
{
const nodes = validateByRetainingPath('Node / ZlibStream', []);
assert.strictEqual(nodes.length, 0);
}
const gzip = zlib.createGzip();
// After zlib stream is created, a ZlibStream should be created.
{
const streams = validateByRetainingPath('Node / ZlibStream', []);
validateByRetainingPathFromNodes(streams, 'Node / ZlibStream', [
{ node_name: 'Zlib', edge_name: 'native_to_javascript' },
]);
// No entry for memory because zlib memory is initialized lazily.
const withMemory = validateByRetainingPathFromNodes(streams, 'Node / ZlibStream', [
{ node_name: 'Node / zlib_memory', edge_name: 'zlib_memory' },
], true);
assert.strictEqual(withMemory.length, 0);
}
// After zlib stream is written, zlib_memory should be created.
gzip.write('hello world', common.mustCall(() => {
validateByRetainingPath('Node / ZlibStream', [
{ node_name: 'Node / zlib_memory', edge_name: 'zlib_memory' },
]);
}));