node --heap-prof --heap-prof-dir=prof server.js

Category: Node.js & npm/yarn

node --heap-prof --heap-prof-dir=prof server.js

Profile JavaScript heap usage to a file

Samples the V8 heap during the run and writes a .heapprofile file into the prof directory, loadable in Chrome DevTools to find memory leaks. The heap profiler adds modest overhead, so profile in staging first. Analyze with the Memory panel of DevTools.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.