Rob Evans
Rob Evans

Reputation: 6968

Node.js Heap Snapshots and Google Chrome Snapshot Viewer

Is there any way to take a heap snapshot from a running Node.js process and then load it into the Google Chrome profiles viewer? It would be very awesome to be able to use the really useful Chrome profiles tab to view Node.js snapshots.

If it is possible to do, can someone provide a step-by-step of how to produce a snapshot in Node.js and then load it into Chrome?

Upvotes: 5

Views: 3765

Answers (1)

Brandon
Brandon

Reputation: 10028

There is an NPM module to do this.

https://github.com/bnoordhuis/node-heapdump

Just require() the module and then you can send kill -USR2 to the node process. It creates a V8 heap dump that you can view in Chrome.

Upvotes: 8

Related Questions