External Buffer Memory Example
- we can use that to first filter all Buffers and then get at what's in them
snapshot.requestNodesByName('Uint8Array', onBufferNode)
function onBufferNode(node) {
let buf = profiler.getObjectByHeapObjectId(node.id)
if (!Buffer.isBuffer(buf)) {
if (Object.getPrototypeOf(buf) === Uint8Array.prototype) buf = new Buffer(buf)
else return
}
buffers.push({
buf : buf,
length : buf.length,
bufferType : node.name,
type : node.type,
id : node.id,
shallowSize : node.shallowSize,
hash : hashBuffer(buf)
})
}