BDD style memory leak hunting tool. See example/simple.js
Memdiff is experimental. I've been noticing some inconsistency, haven't had time for checking out and fixing yet.
$ npm install -g memdiff
Requires Node v0.8.x
$ memdiff --help
// example/simple.js
function SimpleClass(){}
var leaks = [];
describe('SimpleClass', function(){
it('is leaking', function(){
leaks.push(new SimpleClass);
});
it('is async and not leaking', function(done){
new SimpleClass;
process.nextTick(done);
});
});
var memdiff = require('memdiff');
function SimpleClass(){}
var leaks = [];
function leaking(){
leaks.push(new SimpleClass);
}
memdiff(leaking, function(result){ // or memdiff({ fn: leaking, duration: 15, times: 9999, interval: 1 ....
console.log('leaking: ', result.size);
});