Skip to content Skip to sidebar Skip to footer

Filtering Unwanted Strings In V8 Heap Snapshot Programmatically (without Dev-tool GUI)

I have a Node app that sends JavaScript source code as string to a worker thread that executes it in Node's VM api. I am taking a snapshot of the worker thread's heap only. This is

Solution 1:

Perhaps this is due to using require() and import?

Essentially yes. You wanted all strings, you're getting all strings. JavaScript uses lots of strings. (The specific import mechanism doesn't matter. If you execute any code, you'll see its strings/etc in the heap snapshot.)

Would it be possible to retrieve the context id of the VM and then filter the heap snapshot for strings lived in that specific context?

No, there is no association between heap objects and contexts.


Post a Comment for "Filtering Unwanted Strings In V8 Heap Snapshot Programmatically (without Dev-tool GUI)"