memdiff
BDD style memory leak hunting tool. See example/simple.js
Warning
Memdiff is experimental. I've been noticing some inconsistency, haven't had time for checking out and fixing yet.
Install
$ npm install -g memdiff
Requires Node v0.8.x
Usage
$ memdiff --help
Example Module
// 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);
});
});
API
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);
});