What is a good method for detecting memory leak in node.js?

When deploying, my node.js application crashes memory errors (i.e. FATAL ERROR: CALL_AND_RETRY_0). Allocation failed - processing from memory). I would like to profile my node locally to find out what the memory was, but I'm not sure where to start.

+4
source share
1 answer

You can use node-inspector and v8-profiler to do this. Install it from npm:

$ npm install v8-profiler 

And then use it to get heap snapshots (taken from the instructions):

 var profiler = require('v8-profiler'); var snapshot = profiler.takeSnapshot([name]) //takes a heap snapshot 
+2
source

Source: https://habr.com/ru/post/1389868/


All Articles