node-memwatch
node-memwatch copied to clipboard
Sending STOP and CONT signals to a process triggers continuous "stats" event
When memwatch.HeapDiff is used from within the 'stats' handler, and the process is sent a STOP followed by a CONT signal, an infinite loop of 'stats' events is sent.
Here's the code:
memwatch.on('leak', function(info) {
console.log("Leak detected by memwatch");
console.dir(info);
});
var hd = new memwatch.HeapDiff();
memwatch.on('stats', function(stats) {
console.log("Memwatch stats");
console.dir(stats);
var diff = hd.end();
console.log("HeapDiff:");
console.dir(diff.change);
console.dir(diff.details);
hd = new memwatch.HeapDiff();
});