Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 324
Rob Evans Avatar asked Oct 26 '12 16:10

Rob Evans


1 Answers

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.

like image 98
Brandon Avatar answered Sep 19 '22 23:09

Brandon