From d5a296163698cbf084be85dcfcbb2fabad8e2547 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 23 Jan 2014 19:01:15 +0100 Subject: [PATCH 1/2] Load debug module if release module is unavailable Before this commit, include.js was hard-coded to load the release build of the add-on. Now it falls back to the debug build when the release build is unavailable. Makes life easier for people who build with `node-gyp --debug rebuild` or have npm_config_debug set in the environment. --- include.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include.js b/include.js index a6f5f53..c381b25 100644 --- a/include.js +++ b/include.js @@ -1,6 +1,10 @@ -const -magic = require('./build/Release/memwatch'), -events = require('events'); +const events = require('events'); + +try { + var magic = require('./build/Release/memwatch'); +} catch (e) { + var magic = require('./build/Debug/memwatch'); +} module.exports = new events.EventEmitter(); From 89f5556f41db17abe62550f3b5cc60f36f5c31ce Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 23 Jan 2014 19:07:14 +0100 Subject: [PATCH 2/2] Don't close handle scope in GC epilogue callback Don't call v8::HandleScope::Close() from the 'after GC' callback, there is no parent handle scope to move the value to. Fixes the following error in node.js debug builds: FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope --- src/memwatch.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/memwatch.cc b/src/memwatch.cc index d64d544..a8d5aa8 100644 --- a/src/memwatch.cc +++ b/src/memwatch.cc @@ -233,8 +233,6 @@ void memwatch::after_gc(GCType type, GCCallbackFlags flags) // windows. see: https://github.com/joyent/libuv/pull/629 uv_queue_work(uv_default_loop(), &(baton->req), noop_work_func, (uv_after_work_cb)AsyncMemwatchAfter); - - scope.Close(Undefined()); } Handle memwatch::upon_gc(const Arguments& args) {