-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
Expand file tree
/
Copy pathtest-heapdump-hash.js
More file actions
33 lines (26 loc) · 966 Bytes
/
test-heapdump-hash.js
File metadata and controls
33 lines (26 loc) · 966 Bytes
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
'use strict';
require('../common');
const { validateByRetainingPath } = require('../common/heap');
const { createHash } = require('crypto');
const assert = require('assert');
// In case the bootstrap process creates any Hash objects, capture a snapshot first
// and save the initial length.
const originalNodes = validateByRetainingPath('Node / Hash', [
{ edge_name: 'mdctx' },
], true);
const count = 5;
const arr = [];
for (let i = 0; i < count; ++i) {
arr.push(createHash('sha1'));
}
const nodesWithCtx = validateByRetainingPath('Node / Hash', [
{ edge_name: 'mdctx', node_name: 'Node / EVP_MD_CTX' },
]);
assert.strictEqual(nodesWithCtx.length - originalNodes.length, count);
for (let i = 0; i < count; ++i) {
arr[i].update('test').digest('hex');
}
const nodesWithDigest = validateByRetainingPath('Node / Hash', [
{ edge_name: 'md', node_name: 'Node / ByteSource' },
]);
assert.strictEqual(nodesWithDigest.length - originalNodes.length, count);