Skip to content

Instantly share code, notes, and snippets.

@aturley
Created March 22, 2012 17:32
Show Gist options
  • Save aturley/2160454 to your computer and use it in GitHub Desktop.
Save aturley/2160454 to your computer and use it in GitHub Desktop.
This generates a heapdump.
var profiler = require('v8-profiler');
var MyClass = function(x) {
this.x = x;
};
MyClass.prototype.getX = function() {
return x;
};
var a = [1,2,3];
var b = {"a":1};
var c = 6;
var deadbeefisgood = "DEADBEEFMIGHTBEGOOD";
var x = new MyClass(78797);
var xx = x.getX();
var snapshot = profiler.takeSnapshot(["hello"], "full");
console.log(snapshot.stringify());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment