memdiff

BDD style memory leak hunting tool.

npm install memdiff
10 downloads in the last week
23 downloads in the last month

BDD style memory leak hunting tool. See example/simple.js

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);
});
npm loves you