Coder Social home page Coder Social logo

node-memwatch's Introduction

node-memwatch: Leak Detection and Heap Diffing for Node.JS

Build Status

node-memwatch is here to help you detect and find memory leaks in Node.JS code. It provides:

  • A leak event, emitted when it appears your code is leaking memory.

  • A stats event, emitted occasionally, giving you data describing your heap usage and trends over time.

  • A HeapDiff class that lets you compare the state of your heap between two points in time, telling you what has been allocated, and what has been released.

Installation

  • npm install memwatch

or

  • git clone git://github.com/lloyd/node-memwatch.git

Description

There are a growing number of tools for debugging and profiling memory usage in Node.JS applications, but there is still a need for a platform-independent native module that requires no special instrumentation. This module attempts to satisfy that need.

To get started, import node-memwatch like so:

var memwatch = require('memwatch');

Leak Detection

You can then subscribe to leak events. A leak event will be emitted when your heap usage has increased for five consecutive garbage collections:

memwatch.on('leak', function(info) { ... });

The info object will look something like:

{ start: Fri, 29 Jun 2012 14:12:13 GMT,
  end: Fri, 29 Jun 2012 14:12:33 GMT,
  growth: 67984,
  reason: 'heap growth over 5 consecutive GCs (20s) - 11.67 mb/hr' }

Heap Usage

The best way to evaluate your memory footprint is to look at heap usage right aver V8 performs garbage collection. memwatch does exactly this - it checks heap usage only after GC to give you a stable baseline of your actual memory usage.

When V8 performs a garbage collection (technically, we're talking about a full GC with heap compaction), memwatch will emit a stats event.

memwatch.on('stats', function(stats) { ... });

The stats data will look something like this:

{
  "num_full_gc": 17,
  "num_inc_gc": 8,
  "heap_compactions": 8,
  "estimated_base": 2592568,
  "current_base": 2592568,
  "min": 2499912,
  "max": 2592568,
  "usage_trend": 0
}

estimated_base and usage_trend are tracked over time. If usage trend is consistently positive, it indicates that your base heap size is continuously growing and you might have a leak.

V8 has its own idea of when it's best to perform a GC, and under a heavy load, it may defer this action for some time. To aid in speedier debugging, memwatch provides a gc() method to force V8 to do a full GC and heap compaction.

Heap Diffing

So far we have seen how memwatch can aid in leak detection. For leak isolation, it provides a HeapDiff class that takes two snapshots and computes a diff between them. For example:

// Take first snapshot
var hd = new memwatch.HeapDiff();

// do some things ...

// Take the second snapshot and compute the diff
var diff = hd.end();

The contents of diff will look something like:

{
  "before": { "nodes": 11625, "size_bytes": 1869904, "size": "1.78 mb" },
  "after":  { "nodes": 21435, "size_bytes": 2119136, "size": "2.02 mb" },
  "change": { "size_bytes": 249232, "size": "243.39 kb", "freed_nodes": 197,
    "allocated_nodes": 10007,
    "details": [
      { "what": "String",
        "size_bytes": -2120,  "size": "-2.07 kb",  "+": 3,    "-": 62
      },
      { "what": "Array",
        "size_bytes": 66687,  "size": "65.13 kb",  "+": 4,    "-": 78
      },
      { "what": "LeakingClass",
        "size_bytes": 239952, "size": "234.33 kb", "+": 9998, "-": 0
      }
    ]
  }

The diff shows that during the sample period, the total number of allocated String and Array classes decreased, but Leaking Class grew by 9998 allocations. Hmmm.

You can use HeapDiff in your on('stats') callback; even though it takes a memory snapshot, which triggers a V8 GC, it will not trigger the stats event itself. Because that would be silly.

Future Work

Please see the Issues to share suggestions and contribute!

License

http://wtfpl.org

node-memwatch's People

Contributors

jedp avatar jhaynie avatar jmatthewsr avatar lloyd avatar mscdex avatar rvagg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-memwatch's Issues

npm install fails on CentOS 5.7

I am using Node version 0.8.6. Here is the output when I try to install memwatch:

[email protected] install /home/aforth/code/noschema/api/node_modules/memwatch
node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: Command failed: Unknown option: --
gyp ERR! stack usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
gyp ERR! stack Try python -h' for more information. gyp ERR! stack gyp ERR! stack at ChildProcess.exithandler (child_process.js:536:15) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:91:17) gyp ERR! stack at maybeClose (child_process.js:634:16) gyp ERR! stack at Socket.ChildProcess.spawn.stdin (child_process.js:806:11) gyp ERR! stack at Socket.EventEmitter.emit (events.js:88:17) gyp ERR! stack at Socket._destroy.destroyed (net.js:356:10) gyp ERR! stack at process.startup.processNextTick.process._tickCallback (node.js:244:9) gyp ERR! System Linux 2.6.18-274.el5 gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/aforth/code/noschema/api/node_modules/memwatch gyp ERR! node -v v0.8.6 gyp ERR! node-gyp -v v0.6.3 gyp ERR! not ok npm ERR! [email protected] install:node-gyp rebuild npm ERR!sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the memwatch package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls memwatch
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 2.6.18-274.el5
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "memwatch"
npm ERR! cwd /home/aforth/code/noschema/api/node_modules
npm ERR! node -v v0.8.6
npm ERR! npm -v 1.1.48
npm ERR! code ELIFECYCLE


Thank you.

memwatch crashed on windows7

i try to use node-memwatch on windows7 64bit / node 0.8.14

my code is below

var memwatch = require('memwatch');

function LeakingClass() {}

memwatch.on('leak', function(info) {
  console.log(info);
});

var leaks = [];
setInterval(function() {
  for ( var i = 0; i < 100; i++) {
    leaks.push(new LeakingClass);
  }
}, 1000);

i execute this command.

node --debug leak.js

and

node leak.js

then node is crashed and report this message.

Assertion failed: req->work_cb, file src\win\threadpool.c, line 46

Install fails in Ubuntu 12.04 (32 bit)

$ npm install memwatch
npm http GET https://registry.npmjs.org/memwatch
npm http 304 https://registry.npmjs.org/memwatch

> [email protected] install /scratch/rotogamesq_debug/node_modules/memwatch
> node-gyp rebuild

make: Entering directory `/scratch/rotogamesq_debug/node_modules/memwatch/build'
make: Warning: File `../binding.gyp' has modification time 6.5e+05 s in the future
  ACTION Regenerating Makefile
Traceback (most recent call last):
  File "/home/felix/.node-gyp/0.8.14/tools/gyp/gyp", line 18, in <module>
    sys.exit(gyp.main(sys.argv[1:]))
  File "/home/felix/.node-gyp/0.8.14/tools/gyp/pylib/gyp/__init__.py", line 511, in main
    return gyp_main(args)
  File "/home/felix/.node-gyp/0.8.14/tools/gyp/pylib/gyp/__init__.py", line 494, in gyp_main
    options.circular_check)
  File "/home/felix/.node-gyp/0.8.14/tools/gyp/pylib/gyp/__init__.py", line 133, in Load
    depth, generator_input_info, check, circular_check)
  File "/home/felix/.node-gyp/0.8.14/tools/gyp/pylib/gyp/input.py", line 2378, in Load
    depth, check)
  File "/home/felix/.node-gyp/0.8.14/tools/gyp/pylib/gyp/input.py", line 358, in LoadTargetBuildFile
    includes, True, check)
  File "/home/felix/.node-gyp/0.8.14/tools/gyp/pylib/gyp/input.py", line 208, in LoadOneBuildFile
    raise Exception("%s not found (cwd: %s)" % (build_file_path, os.getcwd()))
Exception: binding.gyp not found (cwd: /scratch/rotogamesq_debug/node_modules/memwatch/build) while trying to load binding.gyp
make: *** [Makefile] Error 1
make: Leaving directory `/scratch/rotogamesq_debug/node_modules/memwatch/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/nodejs/npm/node_modules/node-gyp/lib/build.js:236:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:99:17)
gyp ERR! stack     at Process._handle.onexit (child_process.js:678:10)
gyp ERR! System Linux 3.2.0-32-generic
gyp ERR! command "node" "/usr/lib/nodejs/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /scratch/rotogamesq_debug/node_modules/memwatch
gyp ERR! node -v v0.8.14
gyp ERR! node-gyp -v v0.7.1
gyp ERR! not ok 
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the memwatch package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls memwatch
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.2.0-32-generic
npm ERR! command "nodejs" "/usr/bin/npm" "install" "memwatch"
npm ERR! cwd /scratch/rotogamesq_debug
npm ERR! node -v v0.8.14
npm ERR! npm -v 1.1.65
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /scratch/rotogamesq_debug/npm-debug.log
npm ERR! not ok code 0

See object content

Hi,

Is there a way to see the actual content of the objects ? My current use case is an application which seems to leak a lot of strings, but I'm not sure about the leak source, and knowing which are these string could be a good hint.

write great docs

simple, straightforward docs on how to use this thing and how to interpret the results are needed.

Install fails on Mountain Lion with Node v0.10.5

Here's what I am getting, it would be great if you could help with this:

npm http GET https://registry.npmjs.org/memwatch
npm http 304 https://registry.npmjs.org/memwatch

[email protected] install /usr/local/lib/node_modules/memwatch
node-gyp rebuild

gyp http GET http://nodejs.org/dist/v0.10.5/node-v0.10.5.tar.gz
gyp http 200 http://nodejs.org/dist/v0.10.5/node-v0.10.5.tar.gz
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: EPERM, utime '/Users/jeanpaul/.node-gyp/0.10.5'
gyp ERR! System Darwin 12.3.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/memwatch
gyp ERR! node -v v0.10.5
gyp ERR! node-gyp -v v0.9.5
gyp ERR! This is a bug in node-gyp.
gyp ERR! Please file an Issue:
gyp ERR! https://github.com/TooTallNate/node-gyp/issues
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! sh "-c" "node-gyp rebuild" failed with 7
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the memwatch package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls memwatch
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 12.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "memwatch"
npm ERR! cwd /Users/jeanpaul
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/jeanpaul/npm-debug.log
npm ERR! not ok code 0

Module version mismatch

I added memwatch to package.json and ran npm install. When I tried to execute a script that uses memwatch I got the following error:

module.js:349
  Module._extensions[extension](this, filename);
                               ^
Error: Module version mismatch. Expected 13, got 11.
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)
    at Module.require (module.js:357:17)
    at require (module.js:373:17)
    at Object.<anonymous> (/Users/brianpark/workspace/test/node_modules/memwatch/include.js:2:9)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)
    at Module.require (module.js:357:17)

So I deleted node_modules and tried npm install again from scratch but I still get the same error.

I'm using Mac OS X 10.7.5 and my node version is v0.10.24. Does anybody else have this problem? What is the fix or a workaround?

Segfault on CentOS 6.3 64 bit

Hi,

I'm getting a segmentation fault and cannot seem to use memwatch. Sometimes a glibc error comes out reporting a double free, and sometimes a glibc error comes out report a free call was made on an invalid pointer.

I'm trying to run memwatch in node v0.8.20 on a 64 bit CentOS 6.3 installation. Has anyone else run into this issue?

Thanks!

npm install fail on mac

npm http GET https://registry.npmjs.org/memwatch
npm http 304 https://registry.npmjs.org/memwatch

[email protected] install /Applications/hammersmith/khwaja/delApiKey/hs-web-service/hs-web-service/node_modules/memwatch
node-gyp rebuild

CXX(target) Release/obj.target/memwatch/src/heapdiff.o
make: c++: No such file or directory
make: *** [Release/obj.target/memwatch/src/heapdiff.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:255:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:99:17)
gyp ERR! stack at Process._handle.onexit (child_process.js:678:10)
gyp ERR! System Darwin 12.2.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Applications/hammersmith/khwaja/delApiKey/hs-web-service/hs-web-service/node_modules/memwatch
gyp ERR! node -v v0.8.18
gyp ERR! node-gyp -v v0.8.2
gyp ERR! not ok
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! sh "-c" "node-gyp rebuild" failed with 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the memwatch package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls memwatch
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 12.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "memwatch"
npm ERR! cwd /Applications/hammersmith/khwaja/delApiKey/hs-web-service/hs-web-service/node_modules
npm ERR! node -v v0.8.18
npm ERR! npm -v 1.2.2
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Applications/hammersmith/khwaja/delApiKey/hs-web-service/hs-web-service/node_modules/npm-debug.log
npm ERR! not ok code 0

Does not support on node.js v.0.12

npm WARN package.json [email protected] querystring is also the name of a node core module.
/

[email protected] install /home/bot/test/node_modules/memwatch
node-gyp rebuild

child_process: customFds option is deprecated, use stdio instead.
make: Entering directory /home/bot/test/node_modules/memwatch/build' CXX(target) Release/obj.target/memwatch/src/heapdiff.o In file included from ../src/heapdiff.cc:5: ../src/heapdiff.hh:15: error: expected class-name before โ€˜{โ€™ token ../src/heapdiff.hh:19: error: expected unqualified-id before โ€˜&โ€™ token ../src/heapdiff.hh:19: error: expected โ€˜)โ€™ before โ€˜&โ€™ token ../src/heapdiff.hh:19: error: expected โ€˜;โ€™ before โ€˜&โ€™ token ../src/heapdiff.hh:20: error: expected unqualified-id before โ€˜&โ€™ token ../src/heapdiff.hh:20: error: expected โ€˜)โ€™ before โ€˜&โ€™ token ../src/heapdiff.hh:20: error: expected โ€˜;โ€™ before โ€˜&โ€™ token ../src/heapdiff.cc: In constructor โ€˜heapdiff::HeapDiff::HeapDiff()โ€™: ../src/heapdiff.cc:30: error: class โ€˜heapdiff::HeapDiffโ€™ does not have any field named โ€˜ObjectWrapโ€™ /home/bot/.node-gyp/0.12.0/deps/v8/include/v8.h: In static member function โ€˜static void heapdiff::HeapDiff::Initialize(v8::Handle<v8::Object>)โ€™: /home/bot/.node-gyp/0.12.0/deps/v8/include/v8.h:816: error: โ€˜v8::HandleScope::HandleScope()โ€™ is protected ../src/heapdiff.cc:51: error: within this context ../src/heapdiff.cc:52: error: โ€˜Newโ€™ was not declared in this scope ../src/heapdiff.cc:54: error: โ€˜NewSymbolโ€™ is not a member of โ€˜v8::Stringโ€™ ../src/heapdiff.cc:56: error: โ€˜Endโ€™ was not declared in this scope ../src/heapdiff.cc:58: error: โ€˜NewSymbolโ€™ is not a member of โ€˜v8::Stringโ€™ ../src/heapdiff.cc: At global scope: ../src/heapdiff.cc:62: error: expected unqualified-id before โ€˜&โ€™ token ../src/heapdiff.cc:62: error: expected โ€˜)โ€™ before โ€˜&โ€™ token ../src/heapdiff.cc:62: error: expected initializer before โ€˜&โ€™ token ../src/heapdiff.cc:23: warning: โ€˜s_startTimeโ€™ defined but not used make: *** [Release/obj.target/memwatch/src/heapdiff.o] Error 1 make: Leaving directory/home/bot/test/node_modules/memwatch/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/nodebot/IBMSVT32/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:268:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
gyp ERR! System Linux 2.6.32-504.el6.ppc64
gyp ERR! command "node" "/home/nodebot/IBMSVT32/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/bot/test/node_modules/memwatch
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
npm ERR! Linux 2.6.32-504.el6.ppc64
npm ERR! argv "/home/bot/T32/bin/node" "/home/bot/32/bin/npm" "install" "memwatch"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the memwatch package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls memwatch
npm ERR! There is likely additional logging output above.

Is this module still alive?

Basically, my question is already in the title? Is this module still alive?

Last commit has been in March 2013, 8 open pull requests โ€ฆ it would really be a pity if this project was discontinued.

Any comments on this?

Tool Confusion

Hi!
I have a node app with a memory leak. I know this because my OS thinks that the 'node' application keeps consuming more and more ram. I've been trying in vain to find the source of this for some time now with no luck. Using node-memwatch, I am consistently reported:

after: 
   { nodes: 93563,
     time: Sat Feb 02 2013 16:20:25 GMT-0800 (PST),
     size_bytes: 21457040,
     size: '20.46 mb' },

from a new memwatch.HeapDiff() which I run periodically. The size fluctuates between 20 and 30 MB, which is fine for my application. However, the OS thinks that the real memory consumption of the app keeps growing, all the way up to 1GB.

What might the cause of the differing reports be? I've tried the same app with node-memwatch on both OSX and Solaris/Joyent-smartmachine

How to read the heap diff?

I have an application where on app start I am creating a HeapDiff and on the leak event I am performing a diff to see what is leaking. One item jumped out at me:

{ what: 'String',
size_bytes: 4785072,
size: '4.56 mb',
'+': 32780,
'-': 563 },

But I am unclear on how I should track this down to the code that is causing the leak. Is there documentation anywhere that can tell me where to look when "what" is "String"? There are also other item's I would be interested in tracking down like "Object" and "Code".

node 0.8 support

I cannot imagine that this thing will "just work" on node 0.8, especially given the changes in build scripts. let's find out and fix it! (and get it running on travis under 0.8 + 0.6)

include "examples" in heapdiff

That is, for each "class" of leaked objects, let's include three examples which are all the information we can discover about specific leaked instances to help a developer find the problem.

build fails on windows vista visual c++ 2008 installed node 10.13

Here's the output:

C:\Users\Joseph Spencer\node-java\node_modules\memwatch>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebu
ild
c:\users\joseph spencer\.node-gyp\0.10.23\deps\v8\include\v8.h(218): warning C4506: no definition for inline function 'v8::Persistent<T> v8::Persistent<T>::New(v8::Handl
e<T>)'
C:\Program Files\Microsoft Visual Studio 9.0\vc\include\xlocale(342): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
C:\Program Files\Microsoft Visual Studio 9.0\vc\include\xlocale(342): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
..\src\memwatch.cc(72): warning C4244: 'initializing' : conversion from 'time_t' to 'size_t', possible loss of data
..\src\memwatch.cc(73): warning C4244: 'initializing' : conversion from 'time_t' to 'int', possible loss of data
..\src\memwatch.cc(74): warning C4244: 'initializing' : conversion from 'time_t' to 'int', possible loss of data
..\src\memwatch.cc(84): warning C4244: 'argument' : conversion from 'double' to 'int', possible loss of data
..\src\memwatch.cc(147): warning C4244: '=' : conversion from 'double' to 'unsigned int', possible loss of data
..\src\memwatch.cc(152): warning C4244: '=' : conversion from 'double' to 'unsigned int', possible loss of data
..\src\memwatch.cc(159): warning C4244: '=' : conversion from 'double' to 'unsigned int', possible loss of data
c:\users\joseph spencer\.node-gyp\0.10.23\deps\v8\include\v8.h(184): warning C4506: no definition for inline function 'v8::Persistent<T> v8::Persistent<T>::New(v8::Handl
e<T>)'
C:\Program Files\Microsoft Visual Studio 9.0\vc\include\xlocale(342): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
..\src\heapdiff.cc(279): warning C4244: 'argument' : conversion from 'unsigned __int64' to 'v8::SnapshotObjectId', possible loss of data
..\src\heapdiff.cc(291): warning C4244: 'argument' : conversion from 'unsigned __int64' to 'v8::SnapshotObjectId', possible loss of data
C:\Program Files\Microsoft Visual Studio 9.0\vc\include\vector(46): warning C4506: no definition for inline function 'v8::Persistent<T> v8::Persistent<T>::New(v8::Handle
<T>)'
LINK : fatal error LNK1181: cannot open input file 'C:\Users\Joseph.obj'
Project : warning PRJ0018: The following environment variables were not found:
gyp ERR! build error
gyp ERR! stack Error: `c:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Windows_NT 6.0.6000
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Joseph Spencer\node-java\node_modules\memwatch
gyp ERR! node -v v0.10.23
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the memwatch package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls memwatch
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.0.6000
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\Users\Joseph Spencer\node-java
npm ERR! node -v v0.10.23
npm ERR! npm -v 1.3.17
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\Joseph Spencer\node-java\npm-debug.log
npm ERR! not ok code 0

C:\Users\Joseph Spencer\node-java>

Node JS on arm processor and debian OS (Node JS crashing on 50 % memory usage)

Hi
We are using node js and express module and providing download files functionality to the users. Its MVC kind of architecture but its used over LAN. We are sending average 50 files per request averaging about 700 mb in size. We have our own c program which writes these files at run time and child node processes which send these files to the users in synchronous fashion. We are using ffi module to call c functions . The problem we are facing is node using 50 % memory and gets crashed also it doesnt free significant amount of memory. H/W config is 1 Ghz single core proc and 512 MB RAM. The question here is why V8 not releasing memory after each request OR is there any special kind of compilation required for node / v8. We have tested our c programs with valgrind and it did not show any memory leak.
Please help me to solve this issue.
Thanks in advance.

`memwatch` might be leaving heap snapshots around

(I'm on node 0.8.8, original question/test code here: https://gist.github.com/3971955)

Talking to lloyd on IRC trying to figure out why RSS increases and never decreases in this bad behaving stream. Expected behavior would be a spike in memory usage, then a reduction as the writes are able to get through. With memwatch included, the expected reduction never happens. lloyd suspects that heap snapshots might not be getting cleaned up.

Conditional jump or move depends on uninitialised value(s)

Memory error reported by valgrind on running memwatch:

==10214== Conditional jump or move depends on uninitialised value(s)
==10214==    at 0x70E403: v8::internal::GlobalHandles::IterateAllRootsWithClassIds(v8::internal::ObjectVisitor*) (in /usr/local/bin/node)
==10214==    by 0x7F970A: v8::internal::NativeObjectsExplorer::FillRetainedObjects() (in /usr/local/bin/node)
==10214==    by 0x7F97CC: v8::internal::NativeObjectsExplorer::IterateAndExtractReferences(v8::internal::SnapshotFillerInterface*) (in /usr/local/bin/node)
==10214==    by 0x7F995B: v8::internal::HeapSnapshotGenerator::FillReferences() (in /usr/local/bin/node)
==10214==    by 0x7F99CD: v8::internal::HeapSnapshotGenerator::GenerateSnapshot() (in /usr/local/bin/node)
==10214==    by 0x72E0B9: v8::internal::HeapProfiler::TakeSnapshotImpl(char const*, int, v8::ActivityControl*) (in /usr/local/bin/node)
==10214==    by 0x1C7DF298: heapdiff::HeapDiff::New(v8::Arguments const&) (in /home/src/node/apps/Windshaft-cartodb/Windshaft-cartodb/node_modules.symlink/memwatch/build/Release/memwatch.node)
==10214==    by 0x6CBCE6: v8::internal::Builtin_HandleApiCallConstruct(v8::internal::(anonymous namespace)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)1>, v8::internal::Isolate*) (in /usr/local/bin/node)

possible crash bug if .end() is not called

when snapshots are deleted in a GC caused by a snapshot, then nodejs can crash.

This case used to be possible in any process where heapdiffs were taken frequently, the only condition required was that a HeapDiff was allocated and no longer referenced, a GC hadn't been run since the last reference was removed, and a new HeapDiff was allocated.

Because we now more aggressively clean up snapshots in end(), the common crash is fixed.

There is another niggle tho. If the client doesn't call end and releases the last reference to a HeapDiff instance, and then invokes new HeapDiff(), a crash is possible.

The only solution I can think of is to use libuv to asynchronously remove snapshots at some point in the future, if we see that the HeapDiff destructor is running as snapshot is being taken. A simpler approach of manually triggering gc before heapdiff did not seem to alleviate the problem...

Some thought and investigation here is in order before writing a buncha code.

memwatch.gc() requires --expose-gc

Missing from documentation: For memwatch.gc() to actually do garbage collection, it is necessary to start Node.js with the option --expose-gc. This can be seen by listening to the stats event.

io.js support?

Hello,
I was wondering if there was a plan to support more recent versions of V8 with this package? I am unable to install for io.js 1.4.2 , but node.js 0.10.33 works just fine. Thanks!

"sed" breaks binding.gyp on windows

On windows (without "sed") the binding.gyp breaks when trying to build node-memwatch:

Exception: Call to 'node --version | sed -e "s/^v\([0-9]*\.[0-9]*\).*$/\1/"' returned exit status 255. while trying to load binding.gyp

Maybe instead of using sed, you can use the node_version.h macros, like

if NODE_VERSION_AT_LEAST(0,8,0)

define NEW_COMPACTION_BEHAVIOR

endif

Installing on CentOS 6, node-gyp rebuild error

When trying to install memwatch using "npm install memwatch", I get this error:

I have CentOS6 with python 2.6.6 installed on server.

[email protected] install /home/[[username]]/public_html/sockets/node_modules/memwatch
node-gyp rebuild

gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: connect ETIMEDOUT
gyp ERR! stack at errnoException (net.js:905:11)
gyp ERR! stack at Object.afterConnect as oncomplete
gyp ERR! System Linux 2.6.32-504.3.3.el6.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/[[username]]/public_html/sockets/node_modules/memwatch
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the memwatch package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls memwatch
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 2.6.32-504.3.3.el6.x86_64
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "memwatch"
npm ERR! cwd /home/[[username]]/public_html/sockets
npm ERR! node -v v0.10.36
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

HeapDiff() option to ignore sizes less than given parameter

Trying to determine a leak source. It's hard to investigate HeapDiff() output, as it's large with many entries of small "size_bytes".

Please add an option to HeapDiff() to ignore sizes less than given parameter, e.g.
HeapDiff({ignoreLessThanBytes: 1024})

Thanks

Assertion Failed: handle->InternalFieldCount > 0

node v0.8.18

var hd = new require('memwatch').HeapDiff();

node: /home/ubuntu/.node-gyp/0.8.18/src/node_object_wrap.h:71: void node::ObjectWrap::Wrap(v8::Handlev8::Object): Assertion `handle->InternalFieldCount() > 0' failed.

OSX runtime issue when using library

I'm trying to use on node 0.8.0 on OSX Snow Leopard and I get the following error when i attempt to use it.

Error: dlopen(/usr/local/lib/node_modules/memwatch/build/Release/memwatch.node, 1): no suitable image found.  Did find:
    /usr/local/lib/node_modules/memwatch/build/Release/memwatch.node: mach-o, but wrong architecture
    at Object.Module._extensions..node (module.js:480:11)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/memwatch/include.js:2:9)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

I've installed the module globally using npm and got no errors. Here is the output log from install.

Jeff-Haynies-MacBook-Air:nettle jhaynie$ sudo npm install memwatch -g
npm http GET https://registry.npmjs.org/memwatch
npm http 304 https://registry.npmjs.org/memwatch

> [email protected] install /usr/local/lib/node_modules/memwatch
> make build

rm -Rf build
node-waf configure
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for program gcc or cc           : /usr/bin/gcc 
Checking for gcc                         : ok  
Checking for node path                   : ok /Users/jhaynie/.node_libraries 
Checking for node prefix                 : ok /usr/local 
'configure' finished successfully (0.317s)
node-waf build
Waf: Entering directory `/usr/local/lib/node_modules/memwatch/build'
[1/5] cxx: src/memwatch.cc -> build/Release/src/memwatch_1.o
[2/5] cxx: src/heapdiff.cc -> build/Release/src/heapdiff_1.o
[3/5] cxx: src/util.cc -> build/Release/src/util_1.o
[4/5] cxx: src/init.cc -> build/Release/src/init_1.o
[5/5] cxx_link: build/Release/src/memwatch_1.o build/Release/src/heapdiff_1.o build/Release/src/util_1.o build/Release/src/init_1.o -> build/Release/memwatch.node
Waf: Leaving directory `/usr/local/lib/node_modules/memwatch/build'
'build' finished successfully (3.531s)
[email protected] /usr/local/lib/node_modules/memwatch

When I run file against the file i get:

Jeff-Haynies-MacBook-Air:nettle jhaynie$  file /usr/local/lib/node_modules/memwatch/build/Release/memwatch.node
/usr/local/lib/node_modules/memwatch/build/Release/memwatch.node: Mach-O bundle i386

Here is some more info about node:

Jeff-Haynies-MacBook-Air:nettle jhaynie$ node
> process.arch
'x64'
> process.versions
{ http_parser: '1.0',
  node: '0.8.0',
  v8: '3.11.10.10',
  ares: '1.7.5-DEV',
  uv: '0.8',
  zlib: '1.2.3',
  openssl: '1.0.0f' }

Any ideas how to resolve this?

Ship with pre-built binaries

Some other modules that require a build step (mongodb bson lib, fibers, etc.) ship with pre-built binaries for various platforms. I'm wondering if adding these to npm is something you'd be interested in?

I ask because we brought in the memwatch dependency today and half the dev team couldn't get it built without jumping through some hoops. The other modules have worked seamlessly in terms of "it just works."

Thanks for considering this!

Chris

npm update: error: no matching function for call to 'uv_queue_work'

node -v = v0.10.0
npm -v = 1.2.14

npm update gives me:

npm http 304 https://registry.npmjs.org/memwatch/0.1.5

> [email protected] install /Users/jacob/Sites/Konfect/node_modules/nodefly/node_modules/memwatch
> node-gyp rebuild

  CXX(target) Release/obj.target/memwatch/src/heapdiff.o
  CXX(target) Release/obj.target/memwatch/src/init.o
  CXX(target) Release/obj.target/memwatch/src/memwatch.o
../src/memwatch.cc:227:5: error: no matching function for call to 'uv_queue_work'
    uv_queue_work(uv_default_loop(), &(baton->req), NULL, AsyncMemwatchAfter);
    ^~~~~~~~~~~~~
/Users/jacob/.node-gyp/0.10.0/deps/uv/include/uv.h:1397:15: note: candidate function not viable: no known conversion from
      'void (uv_work_t *)' to 'uv_after_work_cb' (aka 'void (*)(uv_work_t *, int)') for 4th argument
UV_EXTERN int uv_queue_work(uv_loop_t* loop, uv_work_t* req,
              ^
1 error generated.
make: *** [Release/obj.target/memwatch/src/memwatch.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/node/0.10.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:256:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:754:12)
gyp ERR! System Darwin 12.2.1
gyp ERR! command "node" "/usr/local/Cellar/node/0.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jacob/Sites/Konfect/node_modules/nodefly/node_modules/memwatch
gyp ERR! node -v v0.10.0
gyp ERR! node-gyp -v v0.8.5
gyp ERR! not ok 
npm WARN optional dep failed, continuing [email protected]

When I try npm install memwatch I get:

npm http GET https://registry.npmjs.org/memwatch
npm http 304 https://registry.npmjs.org/memwatch
npm http GET https://registry.npmjs.org/memwatch/-/memwatch-0.2.0.tgz
npm http 200 https://registry.npmjs.org/memwatch/-/memwatch-0.2.0.tgz

> [email protected] install /Users/jacob/Sites/Konfect/node_modules/memwatch
> node-gyp rebuild

  CXX(target) Release/obj.target/memwatch/src/heapdiff.o
  CXX(target) Release/obj.target/memwatch/src/init.o
  CXX(target) Release/obj.target/memwatch/src/memwatch.o
../src/memwatch.cc:227:5: error: no matching function for call to 'uv_queue_work'
    uv_queue_work(uv_default_loop(), &(baton->req), NULL, AsyncMemwatchAfter);
    ^~~~~~~~~~~~~
/Users/jacob/.node-gyp/0.10.0/deps/uv/include/uv.h:1397:15: note: candidate function not viable: no known conversion from
      'void (uv_work_t *)' to 'uv_after_work_cb' (aka 'void (*)(uv_work_t *, int)') for 4th argument
UV_EXTERN int uv_queue_work(uv_loop_t* loop, uv_work_t* req,
              ^
1 error generated.
make: *** [Release/obj.target/memwatch/src/memwatch.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/node/0.10.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:256:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:754:12)
gyp ERR! System Darwin 12.2.1
gyp ERR! command "node" "/usr/local/Cellar/node/0.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jacob/Sites/Konfect/node_modules/memwatch
gyp ERR! node -v v0.10.0
gyp ERR! node-gyp -v v0.8.5
gyp ERR! not ok 
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the memwatch package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls memwatch
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 12.2.1
npm ERR! command "/usr/local/Cellar/node/0.10.0/bin/node" "/usr/local/bin/npm" "install" "memwatch"
npm ERR! cwd /Users/jacob/Sites/Konfect
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/jacob/Sites/Konfect/npm-debug.log
npm ERR! not ok code 0

Memwatch failed to build with node v0.11.16

Hello,

All the problem is describe in title !

Thanks !

  > [email protected] install        /Volumes/DataHD/.../project/node_modules/memwatch
 > node-gyp rebuild

 child_process: customFds option is deprecated, use stdio instead.
  CXX(target) Release/obj.target/memwatch/src/heapdiff.o
  In file included from ../src/heapdiff.cc:5:
 ../src/heapdiff.hh:14:35: error: expected class name
     class HeapDiff : public node::ObjectWrap
                              ^
 ../src/heapdiff.hh:19:49: error: no type named 'Arguments' in namespace 'v8'; did you mean      'v8::internal::Arguments'?
         static v8::Handle<v8::Value> New( const v8::Arguments& args );
                                                 ^~~~~~~~~~~~~
                                            v8::internal::Arguments
       /Users/jeremieca/.node-gyp/0.11.16/deps/v8/include/v8.h:127:7: note: 'v8::internal::Arguments'      declared here
 class Arguments;
          ^
 In file included from ../src/heapdiff.cc:5:
  ../src/heapdiff.hh:20:49: error: no type named 'Arguments' in namespace 'v8'; did you mean      'v8::internal::Arguments'?
         static v8::Handle<v8::Value> End( const v8::Arguments& args );
                                                 ^~~~~~~~~~~~~
                                            v8::internal::Arguments
 /Users/jeremieca/.node-gyp/0.11.16/deps/v8/include/v8.h:127:7: note: 'v8::internal::Arguments' declared here
 class Arguments;
         ^
 ../src/heapdiff.cc:30:34: error: member initializer 'ObjectWrap' does not name a non-static data member or base class
  heapdiff::HeapDiff::HeapDiff() : ObjectWrap(), before(NULL), after(NULL),
                                   ^~~~~~~~~~~~
 ../src/heapdiff.cc:51:21: error: calling a protected constructor of class 'v8::HandleScope'
v8::HandleScope scope;
                       ^

npm install fails, node-gyp rebuild, windows

Here is the error from the bottom of the .log file output from "npm install memwatch"

ERR! [email protected] install: node-gyp rebuild
ERR! cmd "/c" "node-gyp rebuild" failed with 1
ERR!
ERR! Failed at the [email protected] install script.
ERR! This is most likely a problem with the memwatch package,
ERR! not with npm itself.
ERR! Tell the author that this fails on your system:
ERR! node-gyp rebuild
ERR! You can get their info via:
ERR! npm owner ls memwatch
ERR! There is likely additional logging output above.
ERR!
ERR! System Windows_NT 6.1.7601
ERR! command "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" "memwatch"
ERR! cwd C:\skype\msg\trunk\dev\projects\servers\admin_server
ERR! node -v v0.6.17
ERR! npm -v 1.1.21
ERR! code ELIFECYCLE
ERR! message [email protected] install: node-gyp rebuild
ERR! message cmd "/c" "node-gyp rebuild" failed with 1
ERR! errno {}
verbose exit [ 1, true ]

Fails to build on node v0.11.13, Ubuntu 14.04

--(2303:Fri,09 May 14:$ )-- npm install memwatch
npm http GET https://registry.npmjs.org/memwatch
npm http 304 https://registry.npmjs.org/memwatch

> [email protected] install /home/web2/test/node_modules/memwatch
> node-gyp rebuild

make: Entering directory `/home/web2/test/node_modules/memwatch/build'
  CXX(target) Release/obj.target/memwatch/src/heapdiff.o
In file included from ../src/heapdiff.cc:5:0:
../src/heapdiff.hh:15:5: error: expected class-name before โ€˜{โ€™ token
     {
     ^
../src/heapdiff.hh:19:49: error: โ€˜Argumentsโ€™ in namespace โ€˜v8โ€™ does not name a type
         static v8::Handle<v8::Value> New( const v8::Arguments& args );
                                                 ^
../src/heapdiff.hh:19:64: error: ISO C++ forbids declaration of โ€˜argsโ€™ with no type [-fpermissive]
         static v8::Handle<v8::Value> New( const v8::Arguments& args );
                                                                ^
../src/heapdiff.hh:20:49: error: โ€˜Argumentsโ€™ in namespace โ€˜v8โ€™ does not name a type
         static v8::Handle<v8::Value> End( const v8::Arguments& args );
                                                 ^
../src/heapdiff.hh:20:64: error: ISO C++ forbids declaration of โ€˜argsโ€™ with no type [-fpermissive]
         static v8::Handle<v8::Value> End( const v8::Arguments& args );
                                                                ^
../src/heapdiff.cc: In constructor โ€˜heapdiff::HeapDiff::HeapDiff()โ€™:
../src/heapdiff.cc:30:34: error: class โ€˜heapdiff::HeapDiffโ€™ does not have any field named โ€˜ObjectWrapโ€™
 heapdiff::HeapDiff::HeapDiff() : ObjectWrap(), before(NULL), after(NULL),
                                  ^
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h: In static member function โ€˜static void heapdiff::HeapDiff::Initialize(v8::Handle<v8::Object>)โ€™:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:845:13: error: โ€˜v8::HandleScope::HandleScope()โ€™ is protected
   V8_INLINE HandleScope() {}
             ^
../src/heapdiff.cc:51:21: error: within this context
     v8::HandleScope scope;
                     ^
../src/heapdiff.cc:52:70: error: no matching function for call to โ€˜v8::FunctionTemplate::New(v8::Handle<v8::Value> (&)(const int&))โ€™
     v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(New);
                                                                      ^
../src/heapdiff.cc:52:70: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:3519:34: note: static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::Isolate*, v8::FunctionCallback, v8::Handle<v8::Value>, v8::Handle<v8::Signature>, int)
   static Local<FunctionTemplate> New(
                                  ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:3519:34: note:   no known conversion for argument 1 from โ€˜v8::Handle<v8::Value>(const int&)โ€™ to โ€˜v8::Isolate*โ€™
../src/heapdiff.cc:54:21: error: โ€˜NewSymbolโ€™ is not a member of โ€˜v8::Stringโ€™
     t->SetClassName(String::NewSymbol("HeapDiff"));
                     ^
../src/heapdiff.cc:56:44: error: invalid conversion from โ€˜v8::Handle<v8::Value> (*)(const int&)โ€™ to โ€˜v8::FunctionCallback {aka void (*)(const v8::FunctionCallbackInfo<v8::Value>&)}โ€™ [-fpermissive]
     NODE_SET_PROTOTYPE_METHOD(t, "end", End);
                                            ^
In file included from ../src/heapdiff.hh:10:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/src/node.h:210:13: error:   initializing argument 3 of โ€˜void node::NODE_SET_PROTOTYPE_METHOD(v8::Handle<v8::FunctionTemplate>, const char*, v8::FunctionCallback)โ€™ [-fpermissive]
 inline void NODE_SET_PROTOTYPE_METHOD(v8::Handle<v8::FunctionTemplate> recv,
             ^
../src/heapdiff.cc:58:17: error: โ€˜NewSymbolโ€™ is not a member of โ€˜v8::Stringโ€™
     target->Set(v8::String::NewSymbol( "HeapDiff"), t->GetFunction());
                 ^
../src/heapdiff.cc: At global scope:
../src/heapdiff.cc:62:32: error: โ€˜Argumentsโ€™ in namespace โ€˜v8โ€™ does not name a type
 heapdiff::HeapDiff::New (const v8::Arguments& args)
                                ^
../src/heapdiff.cc:62:47: error: ISO C++ forbids declaration of โ€˜argsโ€™ with no type [-fpermissive]
 heapdiff::HeapDiff::New (const v8::Arguments& args)
                                               ^
../src/heapdiff.cc: In static member function โ€˜static v8::Handle<v8::Value> heapdiff::HeapDiff::New(const int&)โ€™:
../src/heapdiff.cc:67:15: error: request for member โ€˜IsConstructCallโ€™ in โ€˜argsโ€™, which is of non-class type โ€˜const intโ€™
     if (!args.IsConstructCall()) {
               ^
../src/heapdiff.cc:70:17: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
                 String::New("Use the new operator to create instances of this object.")));
                 ^
../src/heapdiff.cc:70:89: error: โ€˜ThrowExceptionโ€™ was not declared in this scope
                 String::New("Use the new operator to create instances of this object.")));
                                                                                         ^
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:845:13: error: โ€˜v8::HandleScope::HandleScope()โ€™ is protected
   V8_INLINE HandleScope() {}
             ^
../src/heapdiff.cc:73:21: error: within this context
     v8::HandleScope scope;
                     ^
../src/heapdiff.cc:77:11: error: โ€˜class heapdiff::HeapDiffโ€™ has no member named โ€˜Wrapโ€™
     self->Wrap(args.This());
           ^
../src/heapdiff.cc:77:21: error: request for member โ€˜Thisโ€™ in โ€˜argsโ€™, which is of non-class type โ€˜const intโ€™
     self->Wrap(args.This());
                     ^
../src/heapdiff.cc:82:20: error: โ€˜TakeSnapshotโ€™ is not a member of โ€˜v8::HeapProfilerโ€™
     self->before = v8::HeapProfiler::TakeSnapshot(v8::String::New(""));
                    ^
../src/heapdiff.cc:82:51: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     self->before = v8::HeapProfiler::TakeSnapshot(v8::String::New(""));
                                                   ^
../src/heapdiff.cc:85:17: error: request for member โ€˜Thisโ€™ in โ€˜argsโ€™, which is of non-class type โ€˜const intโ€™
     return args.This();
                 ^
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h: In function โ€˜void buildIDSet(std::set<long unsigned int>*, const v8::HeapGraphNode*, int&)โ€™:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:845:13: error: โ€˜v8::HandleScope::HandleScope()โ€™ is protected
   V8_INLINE HandleScope() {}
             ^
../src/heapdiff.cc:97:21: error: within this context
     v8::HandleScope scope;
                     ^
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h: In function โ€˜v8::Handle<v8::Value> changesetToObject(changeset&)โ€™:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:845:13: error: โ€˜v8::HandleScope::HandleScope()โ€™ is protected
   V8_INLINE HandleScope() {}
             ^
../src/heapdiff.cc:213:21: error: within this context
     v8::HandleScope scope;
                     ^
../src/heapdiff.cc:214:33: error: no matching function for call to โ€˜v8::Array::New()โ€™
     Local<Array> a = Array::New();
                                 ^
../src/heapdiff.cc:214:33: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2486:23: note: static v8::Local<v8::Array> v8::Array::New(v8::Isolate*, int)
   static Local<Array> New(Isolate* isolate, int length = 0);
                       ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2486:23: note:   candidate expects 2 arguments, 0 provided
../src/heapdiff.cc:217:39: error: no matching function for call to โ€˜v8::Object::New()โ€™
         Local<Object> d = Object::New();
                                       ^
../src/heapdiff.cc:217:39: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2457:24: note: static v8::Local<v8::Object> v8::Object::New(v8::Isolate*)
   static Local<Object> New(Isolate* isolate);
                        ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2457:24: note:   candidate expects 1 argument, 0 provided
../src/heapdiff.cc:218:16: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
         d->Set(String::New("what"), String::New(i->first.c_str()));
                ^
../src/heapdiff.cc:218:37: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
         d->Set(String::New("what"), String::New(i->first.c_str()));
                                     ^
../src/heapdiff.cc:219:16: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
         d->Set(String::New("size_bytes"), Integer::New(i->second.size));
                ^
../src/heapdiff.cc:219:70: error: no matching function for call to โ€˜v8::Integer::New(long int&)โ€™
         d->Set(String::New("size_bytes"), Integer::New(i->second.size));
                                                                      ^
../src/heapdiff.cc:219:70: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note:   candidate expects 2 arguments, 1 provided
../src/heapdiff.cc:220:16: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
         d->Set(String::New("size"), String::New(mw_util::niceSize(i->second.size).c_str()));
                ^
../src/heapdiff.cc:220:37: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
         d->Set(String::New("size"), String::New(mw_util::niceSize(i->second.size).c_str()));
                                     ^
../src/heapdiff.cc:221:16: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
         d->Set(String::New("+"), Integer::New(i->second.added));
                ^
../src/heapdiff.cc:221:62: error: no matching function for call to โ€˜v8::Integer::New(long int&)โ€™
         d->Set(String::New("+"), Integer::New(i->second.added));
                                                              ^
../src/heapdiff.cc:221:62: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note:   candidate expects 2 arguments, 1 provided
../src/heapdiff.cc:222:16: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
         d->Set(String::New("-"), Integer::New(i->second.released));
                ^
../src/heapdiff.cc:222:65: error: no matching function for call to โ€˜v8::Integer::New(long int&)โ€™
         d->Set(String::New("-"), Integer::New(i->second.released));
                                                                 ^
../src/heapdiff.cc:222:65: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note:   candidate expects 2 arguments, 1 provided
../src/heapdiff.cc:226:18: error: โ€˜class v8::HandleScopeโ€™ has no member named โ€˜Closeโ€™
     return scope.Close(a);
                  ^
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h: In function โ€˜v8::Handle<v8::Value> compare(const v8::HeapSnapshot*, const v8::HeapSnapshot*)โ€™:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:845:13: error: โ€˜v8::HandleScope::HandleScope()โ€™ is protected
   V8_INLINE HandleScope() {}
             ^
../src/heapdiff.cc:233:21: error: within this context
     v8::HandleScope scope;
                     ^
../src/heapdiff.cc:236:35: error: no matching function for call to โ€˜v8::Object::New()โ€™
     Local<Object> o = Object::New();
                                   ^
../src/heapdiff.cc:236:35: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2457:24: note: static v8::Local<v8::Object> v8::Object::New(v8::Isolate*)
   static Local<Object> New(Isolate* isolate);
                        ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2457:24: note:   candidate expects 1 argument, 0 provided
../src/heapdiff.cc:239:35: error: no matching function for call to โ€˜v8::Object::New()โ€™
     Local<Object> b = Object::New();
                                   ^
../src/heapdiff.cc:239:35: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2457:24: note: static v8::Local<v8::Object> v8::Object::New(v8::Isolate*)
   static Local<Object> New(Isolate* isolate);
                        ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2457:24: note:   candidate expects 1 argument, 0 provided
../src/heapdiff.cc:240:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     b->Set(String::New("nodes"), Integer::New(before->GetNodesCount()));
            ^
../src/heapdiff.cc:240:70: error: no matching function for call to โ€˜v8::Integer::New(int)โ€™
     b->Set(String::New("nodes"), Integer::New(before->GetNodesCount()));
                                                                      ^
../src/heapdiff.cc:240:70: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note:   candidate expects 2 arguments, 1 provided
../src/heapdiff.cc:241:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     b->Set(String::New("time"), NODE_UNIXTIME_V8(s_startTime));
            ^
In file included from ../src/heapdiff.hh:10:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/src/node.h:175:70: error: no matching function for call to โ€˜v8::Date::New(double)โ€™
 #define NODE_UNIXTIME_V8(t) v8::Date::New(1000*static_cast<double>(t))
                                                                      ^
../src/heapdiff.cc:241:33: note: in expansion of macro โ€˜NODE_UNIXTIME_V8โ€™
     b->Set(String::New("time"), NODE_UNIXTIME_V8(s_startTime));
                                 ^
/home/web2/.node-gyp/0.11.13/src/node.h:175:70: note: candidate is:
 #define NODE_UNIXTIME_V8(t) v8::Date::New(1000*static_cast<double>(t))
                                                                      ^
../src/heapdiff.cc:241:33: note: in expansion of macro โ€˜NODE_UNIXTIME_V8โ€™
     b->Set(String::New("time"), NODE_UNIXTIME_V8(s_startTime));
                                 ^
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:3071:23: note: static v8::Local<v8::Value> v8::Date::New(v8::Isolate*, double)
   static Local<Value> New(Isolate* isolate, double time);
                       ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:3071:23: note:   candidate expects 2 arguments, 1 provided
../src/heapdiff.cc:242:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     o->Set(String::New("before"), b);
            ^
../src/heapdiff.cc:244:35: error: no matching function for call to โ€˜v8::Object::New()โ€™
     Local<Object> a = Object::New();
                                   ^
../src/heapdiff.cc:244:35: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2457:24: note: static v8::Local<v8::Object> v8::Object::New(v8::Isolate*)
   static Local<Object> New(Isolate* isolate);
                        ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2457:24: note:   candidate expects 1 argument, 0 provided
../src/heapdiff.cc:245:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     a->Set(String::New("nodes"), Integer::New(after->GetNodesCount()));
            ^
../src/heapdiff.cc:245:69: error: no matching function for call to โ€˜v8::Integer::New(int)โ€™
     a->Set(String::New("nodes"), Integer::New(after->GetNodesCount()));
                                                                     ^
../src/heapdiff.cc:245:69: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note:   candidate expects 2 arguments, 1 provided
../src/heapdiff.cc:246:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     a->Set(String::New("time"), NODE_UNIXTIME_V8(time(NULL)));
            ^
In file included from ../src/heapdiff.hh:10:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/src/node.h:175:70: error: no matching function for call to โ€˜v8::Date::New(double)โ€™
 #define NODE_UNIXTIME_V8(t) v8::Date::New(1000*static_cast<double>(t))
                                                                      ^
../src/heapdiff.cc:246:33: note: in expansion of macro โ€˜NODE_UNIXTIME_V8โ€™
     a->Set(String::New("time"), NODE_UNIXTIME_V8(time(NULL)));
                                 ^
/home/web2/.node-gyp/0.11.13/src/node.h:175:70: note: candidate is:
 #define NODE_UNIXTIME_V8(t) v8::Date::New(1000*static_cast<double>(t))
                                                                      ^
../src/heapdiff.cc:246:33: note: in expansion of macro โ€˜NODE_UNIXTIME_V8โ€™
     a->Set(String::New("time"), NODE_UNIXTIME_V8(time(NULL)));
                                 ^
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:3071:23: note: static v8::Local<v8::Value> v8::Date::New(v8::Isolate*, double)
   static Local<Value> New(Isolate* isolate, double time);
                       ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:3071:23: note:   candidate expects 2 arguments, 1 provided
../src/heapdiff.cc:247:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     o->Set(String::New("after"), a);
            ^
../src/heapdiff.cc:253:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     b->Set(String::New("size_bytes"), Integer::New(s));
            ^
../src/heapdiff.cc:253:53: error: no matching function for call to โ€˜v8::Integer::New(int&)โ€™
     b->Set(String::New("size_bytes"), Integer::New(s));
                                                     ^
../src/heapdiff.cc:253:53: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note:   candidate expects 2 arguments, 1 provided
../src/heapdiff.cc:254:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     b->Set(String::New("size"), String::New(mw_util::niceSize(s).c_str()));
            ^
../src/heapdiff.cc:254:33: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     b->Set(String::New("size"), String::New(mw_util::niceSize(s).c_str()));
                                 ^
../src/heapdiff.cc:259:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     a->Set(String::New("size_bytes"), Integer::New(s));
            ^
../src/heapdiff.cc:259:53: error: no matching function for call to โ€˜v8::Integer::New(int&)โ€™
     a->Set(String::New("size_bytes"), Integer::New(s));
                                                     ^
../src/heapdiff.cc:259:53: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note:   candidate expects 2 arguments, 1 provided
../src/heapdiff.cc:260:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     a->Set(String::New("size"), String::New(mw_util::niceSize(s).c_str()));
            ^
../src/heapdiff.cc:260:33: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     a->Set(String::New("size"), String::New(mw_util::niceSize(s).c_str()));
                                 ^
../src/heapdiff.cc:264:35: error: no matching function for call to โ€˜v8::Object::New()โ€™
     Local<Object> c = Object::New();
                                   ^
../src/heapdiff.cc:264:35: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2457:24: note: static v8::Local<v8::Object> v8::Object::New(v8::Isolate*)
   static Local<Object> New(Isolate* isolate);
                        ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2457:24: note:   candidate expects 1 argument, 0 provided
../src/heapdiff.cc:265:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     c->Set(String::New("size_bytes"), Integer::New(diffBytes));
            ^
../src/heapdiff.cc:265:61: error: no matching function for call to โ€˜v8::Integer::New(int&)โ€™
     c->Set(String::New("size_bytes"), Integer::New(diffBytes));
                                                             ^
../src/heapdiff.cc:265:61: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note:   candidate expects 2 arguments, 1 provided
../src/heapdiff.cc:266:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     c->Set(String::New("size"), String::New(mw_util::niceSize(diffBytes).c_str()));
            ^
../src/heapdiff.cc:266:33: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     c->Set(String::New("size"), String::New(mw_util::niceSize(diffBytes).c_str()));
                                 ^
../src/heapdiff.cc:267:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     o->Set(String::New("change"), c);
            ^
../src/heapdiff.cc:272:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     c->Set(String::New("freed_nodes"), Integer::New(changedIDs.size()));
            ^
../src/heapdiff.cc:272:70: error: no matching function for call to โ€˜v8::Integer::New(std::vector<long unsigned int>::size_type)โ€™
     c->Set(String::New("freed_nodes"), Integer::New(changedIDs.size()));
                                                                      ^
../src/heapdiff.cc:272:70: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note:   candidate expects 2 arguments, 1 provided
../src/heapdiff.cc:288:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     c->Set(String::New("allocated_nodes"), Integer::New(changedIDs.size()));
            ^
../src/heapdiff.cc:288:74: error: no matching function for call to โ€˜v8::Integer::New(std::vector<long unsigned int>::size_type)โ€™
     c->Set(String::New("allocated_nodes"), Integer::New(changedIDs.size()));
                                                                          ^
../src/heapdiff.cc:288:74: note: candidate is:
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
   static Local<Integer> New(Isolate* isolate, int32_t value);
                         ^
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:2074:25: note:   candidate expects 2 arguments, 1 provided
../src/heapdiff.cc:295:12: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     c->Set(String::New("details"), changesetToObject(changes));
            ^
../src/heapdiff.cc:297:18: error: โ€˜class v8::HandleScopeโ€™ has no member named โ€˜Closeโ€™
     return scope.Close(o);
                  ^
../src/heapdiff.cc: At global scope:
../src/heapdiff.cc:301:32: error: โ€˜Argumentsโ€™ does not name a type
 heapdiff::HeapDiff::End( const Arguments& args )
                                ^
../src/heapdiff.cc:301:43: error: ISO C++ forbids declaration of โ€˜argsโ€™ with no type [-fpermissive]
 heapdiff::HeapDiff::End( const Arguments& args )
                                           ^
In file included from ../src/heapdiff.hh:8:0,
                 from ../src/heapdiff.cc:5:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h: In static member function โ€˜static v8::Handle<v8::Value> heapdiff::HeapDiff::End(const int&)โ€™:
/home/web2/.node-gyp/0.11.13/deps/v8/include/v8.h:845:13: error: โ€˜v8::HandleScope::HandleScope()โ€™ is protected
   V8_INLINE HandleScope() {}
             ^
../src/heapdiff.cc:304:21: error: within this context
     v8::HandleScope scope;
                     ^
../src/heapdiff.cc:306:19: error: โ€˜Unwrapโ€™ was not declared in this scope
     HeapDiff *t = Unwrap<HeapDiff>( args.This() );
                   ^
../src/heapdiff.cc:306:34: error: expected primary-expression before โ€˜>โ€™ token
     HeapDiff *t = Unwrap<HeapDiff>( args.This() );
                                  ^
../src/heapdiff.cc:306:42: error: request for member โ€˜Thisโ€™ in โ€˜argsโ€™, which is of non-class type โ€˜const intโ€™
     HeapDiff *t = Unwrap<HeapDiff>( args.This() );
                                          ^
../src/heapdiff.cc:312:16: error: โ€˜ThrowExceptionโ€™ is not a member of โ€˜v8โ€™
         return v8::ThrowException(
                ^
../src/heapdiff.cc:314:17: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
                 v8::String::New("attempt to end() a HeapDiff that was "
                 ^
../src/heapdiff.cc:320:16: error: โ€˜TakeSnapshotโ€™ is not a member of โ€˜v8::HeapProfilerโ€™
     t->after = v8::HeapProfiler::TakeSnapshot(v8::String::New(""));
                ^
../src/heapdiff.cc:320:47: error: โ€˜Newโ€™ is not a member of โ€˜v8::Stringโ€™
     t->after = v8::HeapProfiler::TakeSnapshot(v8::String::New(""));
                                               ^
../src/heapdiff.cc:331:18: error: โ€˜class v8::HandleScopeโ€™ has no member named โ€˜Closeโ€™
     return scope.Close(comparison);
                  ^
../src/heapdiff.cc: In static member function โ€˜static v8::Handle<v8::Value> heapdiff::HeapDiff::New(const int&)โ€™:
../src/heapdiff.cc:86:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
../src/heapdiff.cc: In static member function โ€˜static v8::Handle<v8::Value> heapdiff::HeapDiff::End(const int&)โ€™:
../src/heapdiff.cc:332:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
../src/heapdiff.cc: In function โ€˜v8::Handle<v8::Value> compare(const v8::HeapSnapshot*, const v8::HeapSnapshot*)โ€™:
../src/heapdiff.cc:298:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make: *** [Release/obj.target/memwatch/src/heapdiff.o] Error 1
make: Leaving directory `/home/web2/test/node_modules/memwatch/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/web2/.nvm/v0.11.13/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1046:12)
gyp ERR! System Linux 3.13.0-24-generic
gyp ERR! command "node" "/home/web2/.nvm/v0.11.13/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/web2/test/node_modules/memwatch
gyp ERR! node -v v0.11.13
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok 
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the memwatch package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls memwatch
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/home/web2/.nvm/v0.11.13/bin/node" "/home/web2/.nvm/v0.11.13/bin/npm" "install" "memwatch"
npm ERR! cwd /home/web2/test
npm ERR! node -v v0.11.13
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/web2/test/npm-debug.log
npm ERR! not ok code 0

I suggest you look into this, might be an easy fix:
dainis/node-gcstats#1

include heapdiff in `leak` event

after issue #2 is done, we should add a heapdiff to the leak event to give devs rich information about wtf is going on in their process.

can't install

npm install memwatch --save-dev
/
> [email protected] install /Users/kalle/node_modules/memwatch
> node-gyp rebuild

  CXX(target) Release/obj.target/memwatch/src/heapdiff.o
In file included from ../src/heapdiff.cc:5:
../src/heapdiff.hh:14:35: error: expected class name
    class HeapDiff : public node::ObjectWrap
                                  ^
../src/heapdiff.hh:19:49: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
        static v8::Handle<v8::Value> New( const v8::Arguments& args );
                                                ^~~~~~~~~~~~~
                                                v8::internal::Arguments
/Users/jimmywarting/.node-gyp/0.12.7/deps/v8/include/v8.h:127:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
In file included from ../src/heapdiff.cc:5:
../src/heapdiff.hh:20:49: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
        static v8::Handle<v8::Value> End( const v8::Arguments& args );
                                                ^~~~~~~~~~~~~
                                                v8::internal::Arguments
/Users/jimmywarting/.node-gyp/0.12.7/deps/v8/include/v8.h:127:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/heapdiff.cc:30:34: error: member initializer 'ObjectWrap' does not name a non-static data member or base class
heapdiff::HeapDiff::HeapDiff() : ObjectWrap(), before(NULL), after(NULL),
                                 ^~~~~~~~~~~~
../src/heapdiff.cc:51:21: error: calling a protected constructor of class 'v8::HandleScope'
    v8::HandleScope scope;
                    ^
/Users/jimmywarting/.node-gyp/0.12.7/deps/v8/include/v8.h:816:13: note: declared protected here
  V8_INLINE HandleScope() {}
            ^
../src/heapdiff.cc:52:67: error: cannot initialize a parameter of type 'v8::Isolate *' with an lvalue of type 'v8::Handle<v8::Value> (const v8::internal::Arguments &)'
    v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(New);
                                                                  ^~~
/Users/jimmywarting/.node-gyp/0.12.7/deps/v8/include/v8.h:3456:16: note: passing argument to parameter 'isolate' here
      Isolate* isolate,
               ^
../src/heapdiff.cc:54:29: error: no member named 'NewSymbol' in 'v8::String'
    t->SetClassName(String::NewSymbol("HeapDiff"));
                    ~~~~~~~~^
../src/heapdiff.cc:56:41: error: cannot initialize a parameter of type 'v8::FunctionCallback' (aka 'void (*)(const FunctionCallbackInfo<v8::Value> &)') with an lvalue of type
      'v8::Handle<v8::Value> (const v8::internal::Arguments &)': type mismatch at 1st parameter ('const FunctionCallbackInfo<v8::Value> &' vs 'const v8::internal::Arguments &')
    NODE_SET_PROTOTYPE_METHOD(t, "end", End);
                                        ^~~
/Users/jimmywarting/.node-gyp/0.12.7/src/node.h:246:60: note: passing argument to parameter 'callback' here
                                      v8::FunctionCallback callback) {
                                                           ^
../src/heapdiff.cc:58:29: error: no member named 'NewSymbol' in 'v8::String'
    target->Set(v8::String::NewSymbol( "HeapDiff"), t->GetFunction());
                ~~~~~~~~~~~~^
../src/heapdiff.cc:62:32: error: no type named 'Arguments' in namespace 'v8'; did you mean 'v8::internal::Arguments'?
heapdiff::HeapDiff::New (const v8::Arguments& args)
                               ^~~~~~~~~~~~~
                               v8::internal::Arguments
/Users/jimmywarting/.node-gyp/0.12.7/deps/v8/include/v8.h:127:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/heapdiff.cc:67:14: error: member access into incomplete type 'const v8::internal::Arguments'
    if (!args.IsConstructCall()) {
             ^
/Users/jimmywarting/.node-gyp/0.12.7/deps/v8/include/v8.h:127:7: note: forward declaration of 'v8::internal::Arguments'
class Arguments;
      ^
../src/heapdiff.cc:70:17: error: no member named 'New' in 'v8::String'; did you mean simply 'New'?
                String::New("Use the new operator to create instances of this object.")));
                ^~~~~~~~~~~
                New
../src/heapdiff.cc:62:21: note: 'New' declared here
heapdiff::HeapDiff::New (const v8::Arguments& args)
                    ^
../src/heapdiff.cc:70:29: error: reference to type 'const v8::internal::Arguments' could not bind to an lvalue of type 'const char [57]'
                String::New("Use the new operator to create instances of this object.")));
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/heapdiff.cc:62:47: note: passing argument to parameter 'args' here
heapdiff::HeapDiff::New (const v8::Arguments& args)
                                              ^
../src/heapdiff.cc:73:21: error: calling a protected constructor of class 'v8::HandleScope'
    v8::HandleScope scope;
                    ^
/Users/jimmywarting/.node-gyp/0.12.7/deps/v8/include/v8.h:816:13: note: declared protected here
  V8_INLINE HandleScope() {}
            ^
../src/heapdiff.cc:77:11: error: no member named 'Wrap' in 'heapdiff::HeapDiff'
    self->Wrap(args.This());
    ~~~~  ^
../src/heapdiff.cc:77:20: error: member access into incomplete type 'const v8::internal::Arguments'
    self->Wrap(args.This());
                   ^
/Users/jimmywarting/.node-gyp/0.12.7/deps/v8/include/v8.h:127:7: note: forward declaration of 'v8::internal::Arguments'
class Arguments;
      ^
../src/heapdiff.cc:82:38: error: no member named 'TakeSnapshot' in 'v8::HeapProfiler'
    self->before = v8::HeapProfiler::TakeSnapshot(v8::String::New(""));
                   ~~~~~~~~~~~~~~~~~~^
../src/heapdiff.cc:82:51: error: no member named 'New' in 'v8::String'; did you mean simply 'New'?
    self->before = v8::HeapProfiler::TakeSnapshot(v8::String::New(""));
                                                  ^~~~~~~~~~~~~~~
                                                  New
../src/heapdiff.cc:62:21: note: 'New' declared here
heapdiff::HeapDiff::New (const v8::Arguments& args)
                    ^
../src/heapdiff.cc:82:67: error: reference to type 'const v8::internal::Arguments' could not bind to an lvalue of type 'const char [1]'
    self->before = v8::HeapProfiler::TakeSnapshot(v8::String::New(""));
                                                                  ^~
../src/heapdiff.cc:62:47: note: passing argument to parameter 'args' here
heapdiff::HeapDiff::New (const v8::Arguments& args)
                                              ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/memwatch/src/heapdiff.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Darwin 14.4.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/kalle/node_modules/memwatch
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok 
npm ERR! Darwin 14.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "memwatch" "--save-dev"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the memwatch package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls memwatch
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/kalle/npm-debug.log

Install fails on Ubuntu 12.04 32-bit

$ uname -a
Linux precise32 3.2.0-23-generic-pae #36-Ubuntu SMP Tue Apr 10 22:19:09 UTC 2012 i686 i686 i386 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04 LTS
Release: 12.04
Codename: precise

$ sudo npm install -g memwatch
npm http GET https://registry.npmjs.org/memwatch
npm http 304 https://registry.npmjs.org/memwatch

[email protected] install /usr/local/lib/node_modules/memwatch
node-gyp rebuild

sh: 1: node-gyp: not found
npm ERR! error installing [email protected]

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! sh "-c" "node-gyp rebuild" failed with 127
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the memwatch package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls memwatch
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "memwatch"
npm ERR! cwd /vagrant
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! code ELIFECYCLE
npm ERR! message [email protected] install: node-gyp rebuild
npm ERR! message sh "-c" "node-gyp rebuild" failed with 127
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /vagrant/npm-debug.log
npm not ok

running example slightly_leaky.js does not generate any leak

Hi,

I am trying out node-memwatch using node.js version 0.10.12 on a x64 server but running the slightly_leaky.js example is not giving me any leak in console. I left it to run for a while but no leak.. even changed the loop from 10 to 100 but still no luck.

really weird.. any advice please?

Errors while installing memwatch on XP SP3

unable to install memwatch on windows XP SP3.

C:\Documents and Settings\Gulshan Nihalani>npm install -g memwatch
npm http GET https://registry.npmjs.org/memwatch
npm http 200 https://registry.npmjs.org/memwatch
npm http GET https://registry.npmjs.org/memwatch/-/memwatch-0.2.2.tgz
npm http 200 https://registry.npmjs.org/memwatch/-/memwatch-0.2.2.tgz

[email protected] install C:\Documents and Settings\Gulshan Nihalani\Application
Data\npm\node_modules\memwatch
node-gyp rebuild

C:\Documents and Settings\Gulshan Nihalani\Application Data\npm\node_modules\mem
watch>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\nod
e_modules\node-gyp\bin\node-gyp.js" rebuild
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\nod
e_modules\node-gyp\lib\configure.js:101:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node
-gyp\lib\configure.js:64:11
gyp ERR! stack at Object.oncomplete (fs.js:107:15)
gyp ERR! System Windows_NT 5.1.2600
gyp ERR! command "node" "C:\Program Files\nodejs\node_modules\npm\node_modu
les\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Documents and Settings\Gulshan Nihalani\Application Data\npm\nod
e_modules\memwatch
gyp ERR! node -v v0.10.23
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the memwatch package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls memwatch
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 5.1.2600
npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nod
ejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "memwatch"
npm ERR! cwd C:\Documents and Settings\Gulshan Nihalani
npm ERR! node -v v0.10.23
npm ERR! npm -v 1.3.17
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Documents and Settings\Gulshan Nihalani\npm-debug.log
npm ERR! not ok code 0

C:\Documents and Settings\Gulshan Nihalani>npm owner ls memwatch
npm http GET https://registry.npmjs.org/memwatch
npm http 304 https://registry.npmjs.org/memwatch
lloyd [email protected]

Make 'leak' GC count configurable

It would be nice to be able to configure the number of garbage collections with heap growth that triggers the 'leak' detection. Currently it's hardcoded at 5.

Sending STOP and CONT signals to a process triggers continuous "stats" event

When memwatch.HeapDiff is used from within the 'stats' handler, and the process is sent a STOP followed by a CONT signal, an infinite loop of 'stats' events is sent.

Here's the code:

memwatch.on('leak', function(info) {
  console.log("Leak detected by memwatch");
  console.dir(info);
});

var hd = new memwatch.HeapDiff();

memwatch.on('stats', function(stats) {
  console.log("Memwatch stats");
  console.dir(stats);

  var diff = hd.end();

  console.log("HeapDiff:");
  console.dir(diff.change);
  console.dir(diff.details);

  hd = new memwatch.HeapDiff();
});

Build fails @ Ubuntu 12.04

$ sudo npm install memwatch
[sudo] password for obfuscated: 
npm http GET https://registry.npmjs.org/memwatch
npm http 200 https://registry.npmjs.org/memwatch
npm http GET https://registry.npmjs.org/memwatch/-/memwatch-0.2.2.tgz
npm http 200 https://registry.npmjs.org/memwatch/-/memwatch-0.2.2.tgz

> [email protected] install /home/obfuscated/domains/obfuscated.com/obfuscated/node_modules/memwatch
> node-gyp rebuild

gyp http GET http://nodejs.org/dist/v0.10.7/node-v0.10.7.tar.gz
gyp http 200 http://nodejs.org/dist/v0.10.7/node-v0.10.7.tar.gz
make: Entering directory `/home/obfuscated/domains/obfuscated.com/obfuscated/node_modules/memwatch/build'
  CXX(target) Release/obj.target/memwatch/src/heapdiff.o
In file included from /usr/include/stdio.h:28:0,
                 from /home/obfuscated/.node-gyp/0.10.7/deps/v8/include/v8stdint.h:34,
                 from /home/obfuscated/.node-gyp/0.10.7/deps/v8/include/v8.h:41,
                 from ../src/heapdiff.hh:8,
                 from ../src/heapdiff.cc:5:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.
make: *** [Release/obj.target/memwatch/src/heapdiff.o] Error 1
make: Leaving directory `/home/obfuscated/domains/obfuscated.com/obfuscated/node_modules/memwatch/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.2.0-29-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/obfuscated/domains/obfuscated.com/obfuscated/node_modules/memwatch
gyp ERR! node -v v0.10.7
gyp ERR! node-gyp -v v0.9.5
gyp ERR! not ok 
npm ERR! weird error 1
npm ERR! not ok code 0

npm install memwatch-next fails

Hi

When I tried to install memwatch-next on node v0.12.4 it fails with the following debug output.
It is trying to rebuild the project. Is this expected? Not very experienced in this, should it not install without requiring a local build.

When I installed Python and node-gyp, it then built the project using VS2010 I happened to have installed but came up with a large amount of warnings. When I tested it, I did not get the stats or leak callbacks when running the example.

Apologies if this is a daft question but it looks a really useful module.

Thanks

Tim

C:\Rabin\trunk\sw\mhub\node\node_modules\memwatch-next>if not defined npm_config
_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin...
.\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (rebuild)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\nod
e_modules\node-gyp\lib\configure.js:103:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node
-gyp\lib\configure.js:64:11
gyp ERR! stack at FSReqWrap.oncomplete (evalmachine.:95:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\Program Files\nodejs\node_modules\npm\node_modu
les\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Rabin\trunk\sw\mhub\node\node_modules\memwatch-next
gyp ERR! node -v v0.12.4
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs
\node_modules\npm\bin\npm-cli.js" "install" "memwatch-next"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the memwatch-next package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls memwatch-next
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Rabin\trunk\sw\mhub\node\npm-debug.log

unable to install memwatch in window 8.1 and 10

Hi,
Installing of memwatch files while installing in windows 8.1 and window 10 results in following error.

0 info it worked if it ends with ok
1 verbose cli [ 'E:\Program Files\nodejs\node.exe',
1 verbose cli 'E:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'memwatch' ]
2 info using [email protected]
3 info using [email protected]
4 verbose install initial load of E:\Venkatesh\nodeCode\memwatch\package.json
5 verbose readDependencies loading dependencies from E:\Venkatesh\nodeCode\memwatch\package.json
6 silly cache add args [ 'memwatch', null ]
7 verbose cache add spec memwatch
8 silly cache add parsed spec { raw: 'memwatch',
8 silly cache add scope: null,
8 silly cache add name: 'memwatch',
8 silly cache add rawSpec: '',
8 silly cache add spec: '',
8 silly cache add type: 'range' }
9 silly addNamed memwatch@

10 verbose addNamed "" is a valid semver range for memwatch
11 silly addNameRange { name: 'memwatch', range: '
', hasData: false }
12 silly mapToRegistry name memwatch
13 silly mapToRegistry using default registry
14 silly mapToRegistry registry https://registry.npmjs.org/
15 silly mapToRegistry uri https://registry.npmjs.org/memwatch
16 verbose addNameRange registry:https://registry.npmjs.org/memwatch not in flight; fetching
17 verbose request uri https://registry.npmjs.org/memwatch
18 verbose request no auth needed
19 info attempt registry request try #1 at 6:54:33 PM
20 verbose request id a0ad07aaba122ee4
21 http request GET https://registry.npmjs.org/memwatch
22 http 200 https://registry.npmjs.org/memwatch
23 silly get cb [ 200,
23 silly get { server: 'CouchDB/1.5.0 (Erlang OTP/R16B03)',
23 silly get etag: '"9CNVDN98D4CJU4Y9831AAILAT"',
23 silly get 'content-type': 'application/json',
23 silly get 'cache-control': 'max-age=60',
23 silly get 'content-length': '37366',
23 silly get 'accept-ranges': 'bytes',
23 silly get date: 'Sun, 09 Aug 2015 13:24:36 GMT',
23 silly get via: '1.1 varnish',
23 silly get age: '0',
23 silly get connection: 'keep-alive',
23 silly get 'x-served-by': 'cache-sin6920-SIN',
23 silly get 'x-cache': 'MISS',
23 silly get 'x-cache-hits': '0',
23 silly get 'x-timer': 'S1439126676.324669,VS0,VE500',
23 silly get vary: 'Accept' } ]
24 verbose get saving memwatch to C:\Users\heman\AppData\Roaming\npm-cache\registry.npmjs.org\memwatch.cache.json
25 verbose getCacheStat cache creation not in flight; initializing
26 verbose makeCacheDir UID & GID are irrelevant on win32
27 silly addNameRange number 2 { name: 'memwatch', range: '_', hasData: true }
28 silly addNameRange versions [ 'memwatch',
28 silly addNameRange [ '0.1.0',
28 silly addNameRange '0.1.1',
28 silly addNameRange '0.1.2',
28 silly addNameRange '0.1.3',
28 silly addNameRange '0.1.4',
28 silly addNameRange '0.1.5',
28 silly addNameRange '0.2.0',
28 silly addNameRange '0.2.1',
28 silly addNameRange '0.2.2' ] ]
29 silly addNamed [email protected]
30 verbose addNamed "0.2.2" is a plain semver version for memwatch
31 silly mapToRegistry name memwatch
32 silly mapToRegistry using default registry
33 silly mapToRegistry registry https://registry.npmjs.org/
34 silly mapToRegistry uri https://registry.npmjs.org/memwatch
35 verbose addRemoteTarball https://registry.npmjs.org/memwatch/-/memwatch-0.2.2.tgz not in flight; adding
36 verbose addRemoteTarball [ 'https://registry.npmjs.org/memwatch/-/memwatch-0.2.2.tgz',
36 verbose addRemoteTarball '779e8cd982532b6221b6ed1c1269098bee16f92c' ]
37 info retry fetch attempt 1 at 6:54:34 PM
38 info attempt registry request try #1 at 6:54:34 PM
39 http fetch GET https://registry.npmjs.org/memwatch/-/memwatch-0.2.2.tgz
40 http fetch 200 https://registry.npmjs.org/memwatch/-/memwatch-0.2.2.tgz
41 silly fetchAndShaCheck shasum 779e8cd982532b6221b6ed1c1269098bee16f92c
42 verbose addTmpTarball C:\Users\heman\AppData\Local\Temp\npm-4340-96eeeb15\registry.npmjs.org\memwatch-\memwatch-0.2.2.tgz not in flight; adding
43 verbose addTmpTarball already have metadata; skipping unpack for [email protected]
44 silly cache afterAdd [email protected]
45 verbose afterAdd C:\Users\heman\AppData\Roaming\npm-cache\memwatch\0.2.2\package\package.json not in flight; writing
46 verbose afterAdd C:\Users\heman\AppData\Roaming\npm-cache\memwatch\0.2.2\package\package.json written
47 silly install resolved [ { name: 'memwatch',
47 silly install resolved description: 'Keep an eye on your memory usage, and discover and isolate leaks.',
47 silly install resolved version: '0.2.2',
47 silly install resolved author: { name: 'Lloyd Hilaiel', url: 'http://lloyd.io' },
47 silly install resolved engines: { node: '>= 0.6.0' },
47 silly install resolved repository:
47 silly install resolved { type: 'git',
47 silly install resolved url: 'https://github.com/lloyd/node-memwatch.git' },
47 silly install resolved main: 'include.js',
47 silly install resolved licenses: [ [Object] ],
47 silly install resolved bugs: { url: 'https://github.com/lloyd/node-memwatch/issues' },
47 silly install resolved scripts: { install: 'node-gyp rebuild', test: 'mocha tests' },
47 silly install resolved devDependencies: { mocha: '1.2.2', should: '0.6.3', 'node-gyp': '0.5.7' },
47 silly install resolved contributors: [ [Object], [Object], [Object] ],
47 silly install resolved readme: 'node-memwatch: Leak Detection and Heap Diffing for Node.JS\n============================================================\n\nBuild Status\n\nnode-memwatch is here to help you detect and find memory leaks in\nNode.JS code. It provides:\n\n- A leak event, emitted when it appears your code is leaking memory.\n\n- A stats event, emitted occasionally, giving you\n data describing your heap usage and trends over time.\n\n- A HeapDiff class that lets you compare the state of your heap between\n two points in time, telling you what has been allocated, and what\n has been released.\n\n\nInstallation\n------------\n\n- npm install memwatch\n\nor\n\n- git clone git://github.com/lloyd/node-memwatch.git\n\n\nDescription\n-----------\n\nThere are a growing number of tools for debugging and profiling memory\nusage in Node.JS applications, but there is still a need for a\nplatform-independent native module that requires no special\ninstrumentation. This module attempts to satisfy that need.\n\nTo get started, import node-memwatch like so:\n\njavascript\nvar memwatch = require(\'memwatch\');\n\n\n### Leak Detection\n\nYou can then subscribe to leak events. A leak event will be\nemitted when your heap usage has increased for five consecutive\ngarbage collections:\n\njavascript\nmemwatch.on(\'leak\', function(info) { ... });\n\n\nThe info object will look something like:\n\njavascript\n{ start: Fri, 29 Jun 2012 14:12:13 GMT,\n end: Fri, 29 Jun 2012 14:12:33 GMT,\n growth: 67984,\n reason: \'heap growth over 5 consecutive GCs (20s) - 11.67 mb/hr\' }\n\n\n\n### Heap Usage\n\nThe best way to evaluate your memory footprint is to look at heap\nusage right aver V8 performs garbage collection. memwatch does\nexactly this - it checks heap usage only after GC to give you a stable\nbaseline of your actual memory usage.\n\nWhen V8 performs a garbage collection (technically, we're talking\nabout a full GC with heap compaction), memwatch will emit a stats\nevent.\n\njavascript\nmemwatch.on(\'stats\', function(stats) { ... });\n\n\nThe stats data will look something like this:\n\njavascript\n{\n "num_full_gc": 17,\n "num_inc_gc": 8,\n "heap_compactions": 8,\n "estimated_base": 2592568,\n "current_base": 2592568,\n "min": 2499912,\n "max": 2592568,\n "usage_trend": 0\n}\n\n\nestimated_base and usage_trend are tracked over time. If usage\ntrend is consistently positive, it indicates that your base heap size\nis continuously growing and you might have a leak.\n\nV8 has its own idea of when it's best to perform a GC, and under a\nheavy load, it may defer this action for some time. To aid in\nspeedier debugging, memwatch provides a gc() method to force V8 to\ndo a full GC and heap compaction.\n\n\n### Heap Diffing\n\nSo far we have seen how memwatch can aid in leak detection. For\nleak isolation, it provides a HeapDiff class that takes two snapshots\nand computes a diff between them. For example:\n\njavascript\n// Take first snapshot\nvar hd = new memwatch.HeapDiff();\n\n// do some things ...\n\n// Take the second snapshot and compute the diff\nvar diff = hd.end();\n\n\nThe contents of diff will look something like:\n\njavascript\n{\n "before": { "nodes": 11625, "size_bytes": 1869904, "size": "1.78 mb" },\n "after": { "nodes": 21435, "size_bytes": 2119136, "size": "2.02 mb" },\n "change": { "size_bytes": 249232, "size": "243.39 kb", "freed_nodes": 197,\n "allocated_nodes": 10007,\n "details": [\n { "what": "String",\n "size_bytes": -2120, "size": "-2.07 kb", "+": 3, "-": 62\n },\n { "what": "Array",\n "size_bytes": 66687, "size": "65.13 kb", "+": 4, "-": 78\n },\n { "what": "LeakingClass",\n "size_bytes": 239952, "size": "234.33 kb", "+": 9998, "-": 0\n }\n ]\n }\n\n\nThe diff shows that during the sample period, the total number of\nallocated String and Array classes decreased, but Leaking Class\ngrew by 9998 allocations. Hmmm.\n\nYou can use HeapDiff in your on(\'stats\') callback; even though it\ntakes a memory snapshot, which triggers a V8 GC, it will not trigger\nthe stats event itself. Because that would be silly.\n\n\nFuture Work\n-----------\n\nPlease see the Issues to share suggestions and contribute!\n\n\nLicense\n-------\n\nhttp://wtfpl.org\n',
47 silly install resolved readmeFilename: 'README.md',
47 silly install resolved _id: '[email protected]',
47 silly install resolved dist:
47 silly install resolved { shasum: '779e8cd982532b6221b6ed1c1269098bee16f92c',
47 silly install resolved tarball: 'http://registry.npmjs.org/memwatch/-/memwatch-0.2.2.tgz' },
47 silly install resolved from: 'memwatch@',
47 silly install resolved _npmVersion: '1.2.14',
47 silly install resolved _npmUser: { name: 'lloyd', email: '[email protected]' },
47 silly install resolved maintainers: [ [Object] ],
47 silly install resolved directories: {},
47 silly install resolved _shasum: '779e8cd982532b6221b6ed1c1269098bee16f92c',
47 silly install resolved _resolved: 'https://registry.npmjs.org/memwatch/-/memwatch-0.2.2.tgz' } ]
48 info install [email protected] into E:\Venkatesh\nodeCode\memwatch
49 info installOne [email protected]
50 verbose installOne of memwatch to E:\Venkatesh\nodeCode\memwatch not in flight; installing
51 verbose lock using C:\Users\heman\AppData\Roaming\npm-cache_locks\memwatch-0bffd97e44cc91cf.lock for E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch
52 silly install write writing memwatch 0.2.2 to E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch
53 verbose unbuild node_modules\memwatch
54 silly gentlyRm E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch is being purged from base E:\Venkatesh\nodeCode\memwatch
55 verbose gentlyRm don't care about contents; nuking E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch
56 verbose tar unpack C:\Users\heman\AppData\Roaming\npm-cache\memwatch\0.2.2\package.tgz
57 verbose tar unpacking to E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch
58 silly gentlyRm E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch is being purged
59 verbose gentlyRm don't care about contents; nuking E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch
60 silly gunzTarPerm modes [ '777', '666' ]
61 silly gunzTarPerm extractEntry package.json
62 silly gunzTarPerm modified mode [ 'package.json', 420, 438 ]
63 silly gunzTarPerm extractEntry .npmignore
64 silly gunzTarPerm modified mode [ '.npmignore', 420, 438 ]
65 silly gunzTarPerm extractEntry README.md
66 silly gunzTarPerm modified mode [ 'README.md', 420, 438 ]
67 silly gunzTarPerm extractEntry tests.js
68 silly gunzTarPerm modified mode [ 'tests.js', 420, 438 ]
69 silly gunzTarPerm extractEntry foo.js
70 silly gunzTarPerm modified mode [ 'foo.js', 420, 438 ]
71 silly gunzTarPerm extractEntry include.js
72 silly gunzTarPerm modified mode [ 'include.js', 420, 438 ]
73 silly gunzTarPerm extractEntry .travis.yml
74 silly gunzTarPerm modified mode [ '.travis.yml', 420, 438 ]
75 silly gunzTarPerm extractEntry ChangeLog
76 silly gunzTarPerm modified mode [ 'ChangeLog', 420, 438 ]
77 silly gunzTarPerm extractEntry #wscript#
78 silly gunzTarPerm modified mode [ '#wscript#', 420, 438 ]
79 silly gunzTarPerm extractEntry binding.gyp
80 silly gunzTarPerm modified mode [ 'binding.gyp', 420, 438 ]
81 silly gunzTarPerm extractEntry src/heapdiff.cc
82 silly gunzTarPerm modified mode [ 'src/heapdiff.cc', 420, 438 ]
83 silly gunzTarPerm extractEntry src/heapdiff.hh
84 silly gunzTarPerm modified mode [ 'src/heapdiff.hh', 420, 438 ]
85 silly gunzTarPerm extractEntry src/init.cc
86 silly gunzTarPerm modified mode [ 'src/init.cc', 420, 438 ]
87 silly gunzTarPerm extractEntry src/memwatch.cc
88 silly gunzTarPerm modified mode [ 'src/memwatch.cc', 420, 438 ]
89 silly gunzTarPerm extractEntry src/memwatch.hh
90 silly gunzTarPerm modified mode [ 'src/memwatch.hh', 420, 438 ]
91 silly gunzTarPerm extractEntry src/platformcompat.hh
92 silly gunzTarPerm modified mode [ 'src/platformcompat.hh', 420, 438 ]
93 silly gunzTarPerm extractEntry src/util.cc
94 silly gunzTarPerm modified mode [ 'src/util.cc', 420, 438 ]
95 silly gunzTarPerm extractEntry src/util.hh
96 silly gunzTarPerm modified mode [ 'src/util.hh', 420, 438 ]
97 silly gunzTarPerm extractEntry examples/basic_heapdiff.js
98 silly gunzTarPerm modified mode [ 'examples/basic_heapdiff.js', 420, 438 ]
99 silly gunzTarPerm extractEntry examples/do_nothing_server.js
100 silly gunzTarPerm modified mode [ 'examples/do_nothing_server.js', 420, 438 ]
101 silly gunzTarPerm extractEntry examples/slightly_leaky.js
102 silly gunzTarPerm modified mode [ 'examples/slightly_leaky.js', 420, 438 ]
103 verbose write writing to E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch\package.json
104 info preinstall [email protected]
105 verbose readDependencies loading dependencies from E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch\package.json
106 verbose readDependencies loading dependencies from E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch\package.json
107 silly install resolved []
108 verbose about to build E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch
109 info build E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch
110 info linkStuff [email protected]
111 silly linkStuff [email protected] has E:\Venkatesh\nodeCode\memwatch\node_modules as its parent node_modules
112 verbose linkBins [email protected]
113 verbose linkMans [email protected]
114 verbose rebuildBundles [email protected]
115 info install [email protected]
116 verbose unsafe-perm in lifecycle true
117 info [email protected] Failed to exec install script
118 verbose unlock done using C:\Users\heman\AppData\Roaming\npm-cache_locks\memwatch-0bffd97e44cc91cf.lock for E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch
119 verbose stack Error: [email protected] install: node-gyp rebuild
119 verbose stack Exit status 1
119 verbose stack at EventEmitter. (E:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:213:16)
119 verbose stack at EventEmitter.emit (events.js:110:17)
119 verbose stack at ChildProcess. (E:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
119 verbose stack at ChildProcess.emit (events.js:110:17)
119 verbose stack at maybeClose (child_process.js:1015:16)
119 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
120 verbose pkgid [email protected]
121 verbose cwd E:\Venkatesh\nodeCode\memwatch
122 error Windows_NT 6.3.9600
123 error argv "E:\Program Files\nodejs\node.exe" "E:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "memwatch"
124 error node v0.12.7
125 error npm v2.11.3
126 error code ELIFECYCLE
127 error [email protected] install: node-gyp rebuild
127 error Exit status 1
128 error Failed at the [email protected] install script 'node-gyp rebuild'.
128 error This is most likely a problem with the memwatch package,
128 error not with npm itself.
128 error Tell the author that this fails on your system:
128 error node-gyp rebuild
128 error You can get their info via:
128 error npm owner ls memwatch
128 error There is likely additional logging output above.
129 verbose exit [ 1, true ]
130 verbose unbuild node_modules\memwatch
131 info preuninstall [email protected]
132 info uninstall [email protected]
133 verbose unbuild rmStuff [email protected] from E:\Venkatesh\nodeCode\memwatch\node_modules
134 info postuninstall [email protected]
135 silly gentlyRm E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch is being purged from base E:\Venkatesh\nodeCode\memwatch
136 verbose gentlyRm don't care about contents; nuking E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch
137 silly vacuum-fs purging E:\Venkatesh\nodeCode\memwatch\node_modules\memwatch
138 silly vacuum-fs removing E:\Venkatesh\nodeCode\memwatch\node_modules
139 silly vacuum-fs finished vacuuming up to E:\Venkatesh\nodeCode\memwatch

Please help us in this regard
Regards
Venkatesh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.