Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

BDD style memory leak hunting tool

branch: master
Octocat-spinner-32 bin 1.0.0 August 11, 2013
Octocat-spinner-32 docs 1.0.0 August 11, 2013
Octocat-spinner-32 example allow done callbacks February 20, 2013
Octocat-spinner-32 lib 1.0.0 August 11, 2013
Octocat-spinner-32 .gitignore initial commit February 17, 2013
Octocat-spinner-32 .travis.yml Create .travis.yml May 13, 2013
Octocat-spinner-32 README.md Update README.md March 17, 2014
Octocat-spinner-32 package.json fix main in package.json February 18, 2014
README.md

memdiff Build Status

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);
});
Something went wrong with that request. Please try again.