This instructions allow you to take periodical heapdumps.
To use in your project, first install heapdump, then add the following code to your app just after requiring 'fs'.
require('heapdump'); | |
fs.readdirSync('.').map(function (filename) { | |
if (filename.match(/^heapdump-/)) { | |
console.log(filename); | |
fs.unlinkSync(filename); | |
} | |
}); | |
setInterval(function heapDumper() { | |
process.kill(process.pid, 'SIGUSR2'); | |
}, 15000); |