MCPcopy Index your code
hub / github.com/nodejs/node / readHeapInfo

Function readHeapInfo

test/common/heap.js:65–92  ·  view source on GitHub ↗
(raw, fields, types, strings)

Source from the content-addressed store, hash-verified

63}
64
65function readHeapInfo(raw, fields, types, strings) {
66 const items = [];
67
68 for (let i = 0; i < raw.length; i += fields.length) {
69 const item = {};
70 for (let j = 0; j < fields.length; j++) {
71 const name = fields[j];
72 let type = types[j];
73 if (Array.isArray(type)) {
74 item[name] = type[raw[i + j]];
75 } else if (name === 'name_or_index') { // type === 'string_or_number'
76 if (item.type === 'element' || item.type === 'hidden')
77 type = 'number';
78 else
79 type = 'string';
80 }
81
82 if (type === 'string') {
83 item[name] = strings[raw[i + j]];
84 } else if (type === 'number' || type === 'node') {
85 item[name] = raw[i + j];
86 }
87 }
88 items.push(item);
89 }
90
91 return items;
92}
93
94function inspectNode(snapshot) {
95 return util.inspect(snapshot, { depth: 4 });

Callers 1

createJSHeapSnapshotFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…