Here's how to use:
npm install ofe
require('ofe').call();
This will overwrite OnFatalError
to create a heapdump when your app fatally crashes.
Can also call this to trigger the heapdump manually and exit the process.
require('ofe').trigger();
Overwrite OnFatalError to create a heapdump
License: MIT License
Here's how to use:
npm install ofe
require('ofe').call();
This will overwrite OnFatalError
to create a heapdump when your app fatally crashes.
Can also call this to trigger the heapdump manually and exit the process.
require('ofe').trigger();
You know the drill
When I try to install ofe, this message is shown:
LINK : fatal error LNK1194: cannot delay-load 'node.exe' due to import of data symbol '"__declspec(dllimport) const v8::OutputStream::`vftable'" (__imp_??_7OutputStream@v8@@6B@)'; link without /DELAYLOAD:node.exe [D:\and-dev\testtool-server\testtoolserver\server\node_modules\ofe\build\ofe.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\Diego\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Diego\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\and-dev\testtool-server\testtoolserver\server\node_modules\ofe
gyp ERR! node -v v6.2.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Diego\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "ofe"
npm ERR! node v6.2.0
npm ERR! npm v2.15.6
npm ERR! code ELIFECYCLE
hey, getting this with the latest node (v0.10.5) compiled from source (on Ubuntu):
module.js:356
Module._extensions[extension](this, filename);
^
Error: Module version mismatch. Expected 11, got 1.
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/ubuntu/asdf/node_modules/ofe/ofe.js:1:78)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
$ npm install --save ofe
\
> [email protected] install /home/hertz/projects/dango-device/node_modules/ofe
> node-gyp rebuild
child_process: customFds option is deprecated, use stdio instead.
make: Entering directory '/home/hertz/projects/dango-device/node_modules/ofe/build'
CXX(target) Release/obj.target/ofe/ofe.o
../ofe.cc: In function ‘void OnFatalError(const char*, const char*)’:
../ofe.cc:47:29: error: ‘TakeSnapshot’ is not a member of ‘v8::HeapProfiler’
const HeapSnapshot* snap = HeapProfiler::TakeSnapshot(String::Empty());
^
../ofe.cc:47:70: error: no matching function for call to ‘v8::String::Empty()’
const HeapSnapshot* snap = HeapProfiler::TakeSnapshot(String::Empty());
^
../ofe.cc:47:70: note: candidate is:
In file included from /home/hertz/.node-gyp/0.12.0/src/node.h:61:0,
from ../ofe.cc:1:
/home/hertz/.node-gyp/0.12.0/deps/v8/include/v8.h:6247:15: note: static v8::Local<v8::String> v8::String::Empty(v8::Isolate*)
Local<String> String::Empty(Isolate* isolate) {
^
/home/hertz/.node-gyp/0.12.0/deps/v8/include/v8.h:6247:15: note: candidate expects 1 argument, 0 provided
../ofe.cc: At global scope:
../ofe.cc:54:28: error: ‘Arguments’ does not name a type
Handle<Value> Method(const Arguments& args) {
^
In file included from /home/hertz/.node-gyp/0.12.0/src/node.h:61:0,
from ../ofe.cc:1:
/home/hertz/.node-gyp/0.12.0/deps/v8/include/v8.h: In function ‘v8::Handle<v8::Value> Method(const int&)’:
/home/hertz/.node-gyp/0.12.0/deps/v8/include/v8.h:816:13: error: ‘v8::HandleScope::HandleScope()’ is protected
V8_INLINE HandleScope() {}
^
../ofe.cc:55:14: error: within this context
HandleScope scope;
^
../ofe.cc:57:15: error: ‘class v8::HandleScope’ has no member named ‘Close’
return scope.Close(String::New("done"));
^
../ofe.cc:57:21: error: ‘New’ is not a member of ‘v8::String’
return scope.Close(String::New("done"));
^
../ofe.cc: In function ‘void Init(v8::Handle<v8::Object>)’:
../ofe.cc:62:14: error: ‘NewSymbol’ is not a member of ‘v8::String’
target->Set(String::NewSymbol("call"),
^
../ofe.cc:63:32: error: no matching function for call to ‘v8::FunctionTemplate::New(v8::Handle<v8::Value> (&)(const int&))’
FunctionTemplate::New(Method)->GetFunction());
^
../ofe.cc:63:32: note: candidate is:
In file included from /home/hertz/.node-gyp/0.12.0/src/node.h:61:0,
from ../ofe.cc:1:
/home/hertz/.node-gyp/0.12.0/deps/v8/include/v8.h:3455: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/hertz/.node-gyp/0.12.0/deps/v8/include/v8.h:3455:34: note: no known conversion for argument 1 from ‘v8::Handle<v8::Value>(const int&)’ to ‘v8::Isolate*’
../ofe.cc: In function ‘v8::Handle<v8::Value> Method(const int&)’:
../ofe.cc:58:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
ofe.target.mk:84: recipe for target 'Release/obj.target/ofe/ofe.o' failed
make: *** [Release/obj.target/ofe/ofe.o] Error 1
make: Leaving directory '/home/hertz/projects/dango-device/node_modules/ofe/build'
An example of the heap dump output would be helpful, to see the formatting and content in included.
This was on OS X 10.10.4.
CXX(target) Release/obj.target/ofe/ofe.o
In file included from ../ofe.cc:1:
../node_modules/nan/nan.h:324:27: error: redefinition of 'NanEnsureHandleOrPersistent'
NAN_INLINE v8::Local<T> NanEnsureHandleOrPersistent(const v8::Local<T> &val) {
^
../node_modules/nan/nan.h:319:17: note: previous definition is here
v8::Handle<T> NanEnsureHandleOrPersistent(const v8::Handle<T> &val) {
^
../node_modules/nan/nan.h:344:27: error: redefinition of 'NanEnsureLocal'
NAN_INLINE v8::Local<T> NanEnsureLocal(const v8::Handle<T> &val) {
^
../node_modules/nan/nan.h:334:27: note: previous definition is here
NAN_INLINE v8::Local<T> NanEnsureLocal(const v8::Local<T> &val) {
^
../node_modules/nan/nan.h:757:13: error: no member named 'smalloc' in namespace 'node'
, node::smalloc::FreeCallback callback
~~~~~~^
../node_modules/nan/nan.h:768:12: error: no matching function for call to 'New'
return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
^~~~~~~~~~~~~~~~~
/Users/omni/.node-gyp/4.1.2/include/node/node_buffer.h:31:40: note: candidate function not viable: no known conversion from 'uint32_t' (aka 'unsigned int') to 'enum encoding' for 3rd argument
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
^
/Users/omni/.node-gyp/4.1.2/include/node/node_buffer.h:43:40: note: candidate function not viable: 2nd argument ('const char *') would lose const qualifier
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
^
/Users/omni/.node-gyp/4.1.2/include/node/node_buffer.h:28:40: note: candidate function not viable: requires 2 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
^
/Users/omni/.node-gyp/4.1.2/include/node/node_buffer.h:36:40: note: candidate function not viable: requires 5 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
^
In file included from ../ofe.cc:1:
../node_modules/nan/nan.h:772:12: error: no viable conversion from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object>'
return node::Buffer::New(v8::Isolate::GetCurrent(), size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/omni/.node-gyp/4.1.2/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::MaybeLocal<v8::Object>' to
'const v8::Local<v8::Object> &' for 1st argument
class Local {
^
/Users/omni/.node-gyp/4.1.2/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::MaybeLocal<v8::Object>' to
'v8::Local<v8::Object> &&' for 1st argument
class Local {
^
/Users/omni/.node-gyp/4.1.2/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal'
V8_INLINE Local(Local<S> that)
^
/Users/omni/.node-gyp/4.1.2/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against 'v8::MaybeLocal<v8::Object>'
V8_INLINE Local(S* that)
^
In file included from ../ofe.cc:1:
../node_modules/nan/nan.h:779:26: error: no member named 'Use' in namespace 'node::Buffer'
return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
~~~~~~~~~~~~~~^
../ofe.cc:53:52: error: no viable conversion from 'Local<v8::String>' to 'v8::ActivityControl *'
isolate->GetHeapProfiler()->TakeHeapSnapshot(String::Empty(isolate));
^~~~~~~~~~~~~~~~~~~~~~
/Users/omni/.node-gyp/4.1.2/include/node/v8-profiler.h:487:24: note: passing argument to parameter 'control' here
ActivityControl* control = NULL,
^
In file included from ../ofe.cc:1:
In file included from ../node_modules/nan/nan.h:24:
In file included from /Users/omni/.node-gyp/4.1.2/include/node/node.h:42:
/Users/omni/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Primitive *volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/omni/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:501:12: note: in instantiation of function template specialization 'v8::Local<v8::Primitive>::Local<v8::Value>' requested here
return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent())));
^
../node_modules/nan/nan.h:483:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(Nan::imp::NanEnsureLocal(val))
^
In file included from ../ofe.cc:1:
In file included from ../node_modules/nan/nan.h:24:
In file included from /Users/omni/.node-gyp/4.1.2/include/node/node.h:42:
/Users/omni/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Boolean *volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/omni/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:511:12: note: in instantiation of function template specialization 'v8::Local<v8::Boolean>::Local<v8::Value>' requested here
return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent())));
^
../node_modules/nan/nan.h:483:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(Nan::imp::NanEnsureLocal(val))
^
In file included from ../ofe.cc:1:
In file included from ../node_modules/nan/nan.h:24:
In file included from /Users/omni/.node-gyp/4.1.2/include/node/node.h:42:
/Users/omni/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Function *volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/omni/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1645:12: note: in instantiation of function template specialization 'v8::Local<v8::Function>::Local<v8::Value>' requested here
return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex)
^
../node_modules/nan/nan.h:483:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(Nan::imp::NanEnsureLocal(val))
^
In file included from ../ofe.cc:1:
In file included from ../node_modules/nan/nan.h:24:
In file included from /Users/omni/.node-gyp/4.1.2/include/node/node.h:42:
/Users/omni/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Object *volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/omni/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1776:12: note: in instantiation of function template specialization 'v8::Local<v8::Object>::Local<v8::Value>' requested here
return NanEscapeScope(
^
../node_modules/nan/nan.h:483:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(Nan::imp::NanEnsureLocal(val))
^
11 errors generated.
Getting his error when trying to load with the newest version of Node (0.10.22):
npm http GET https://registry.npmjs.org/ofe
npm http 200 https://registry.npmjs.org/ofe
npm http GET https://registry.npmjs.org/ofe/-/ofe-0.1.2.tgz
npm http 200 https://registry.npmjs.org/ofe/-/ofe-0.1.2.tgz
> [email protected] install /node_modules/ofe
> node-gyp rebuild
gyp http GET http://nodejs.org/dist/v0.10.22/node-v0.10.22.tar.gz
gyp http 200 http://nodejs.org/dist/v0.10.22/node-v0.10.22.tar.gz
xcrun: error: active developer path ("/Library/Developer") does not exist, use xcode-select to change
gyp: Error 1 running xcodebuild
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/.nvm/v0.10.22/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:467:16)
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 Darwin 13.0.0
gyp ERR! command "node" "/.nvm/v0.10.22/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /node_modules/ofe
gyp ERR! node -v v0.10.22
gyp ERR! node-gyp -v v0.11.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 ofe 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 ofe
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 13.0.0
npm ERR! command "/.nvm/v0.10.22/bin/node" "/.nvm/v0.10.22/bin/npm" "install" "ofe"
npm ERR! cwd /
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /npm-debug.log
npm ERR! not ok code 0
% npm install ofe
> [email protected] install /Users/jorisw/Projects/xxx/xxx/node_modules/ofe
> node-gyp rebuild
CXX(target) Release/obj.target/ofe/ofe.o
In file included from ../ofe.cc:1:
In file included from ../../nan/nan.h:2884:
../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908.
[-Wdeprecated-declarations]
data = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
^
/Users/jorisw/Library/Caches/node-gyp/14.1.0/include/node/v8.h:5202:3: note: 'GetContents' has been explicitly marked deprecated here
V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
^
/Users/jorisw/Library/Caches/node-gyp/14.1.0/include/node/v8config.h:402:39: note: expanded from macro 'V8_DEPRECATE_SOON'
# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
^
../ofe.cc:70:7: error: no type named 'SetFatalErrorHandler' in 'v8::V8'
V8::SetFatalErrorHandler(OnFatalError);
~~~~^
../ofe.cc:74:11: error: no template named 'Handle'
void Init(Handle<Object> target) {
^
../ofe.cc:75:7: error: no type named 'SetFatalErrorHandler' in 'v8::V8'
V8::SetFatalErrorHandler(OnFatalError);
~~~~^
../ofe.cc:77:55: error: too few arguments to function call, single argument 'context' was not specified
Nan::New<FunctionTemplate>(Method)->GetFunction());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/jorisw/Library/Caches/node-gyp/14.1.0/include/node/v8.h:6404:3: note: 'GetFunction' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
^
/Users/jorisw/Library/Caches/node-gyp/14.1.0/include/node/v8config.h:422:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
1 warning and 4 errors generated.
make: *** [Release/obj.target/ofe/ofe.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:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Darwin 19.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jorisw/Projects/xxx/xxx/node_modules/ofe
gyp ERR! node -v v14.1.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN [email protected] No license field.
macOS Catalina.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.