-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
add --track-heap-objects #2135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add --track-heap-objects #2135
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- This makes v8 add .trace_function_info to the serialized form of snapshots from v8::HeapSnapshot::Serialize - .trace_funciton_info combined with .trace_node in snapshots tells the JS location that allocated a specific object
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,6 +117,7 @@ static bool trace_deprecation = false; | |
| static bool throw_deprecation = false; | ||
| static bool abort_on_uncaught_exception = false; | ||
| static bool trace_sync_io = false; | ||
| static bool track_heap_objects = false; | ||
| static const char* eval_string = nullptr; | ||
| static unsigned int preload_module_count = 0; | ||
| static const char** preload_modules = nullptr; | ||
|
|
@@ -3053,40 +3054,41 @@ static void PrintHelp() { | |
| " iojs debug script.js [arguments] \n" | ||
| "\n" | ||
| "Options:\n" | ||
| " -v, --version print io.js version\n" | ||
| " -e, --eval script evaluate script\n" | ||
| " -p, --print evaluate script and print result\n" | ||
| " -i, --interactive always enter the REPL even if stdin\n" | ||
| " does not appear to be a terminal\n" | ||
| " -r, --require module to preload (option can be repeated)\n" | ||
| " --no-deprecation silence deprecation warnings\n" | ||
| " --throw-deprecation throw an exception anytime a deprecated " | ||
| " -v, --version print io.js version\n" | ||
| " -e, --eval script evaluate script\n" | ||
| " -p, --print evaluate script and print result\n" | ||
| " -i, --interactive always enter the REPL even if stdin\n" | ||
| " does not appear to be a terminal\n" | ||
| " -r, --require module to preload (option can be repeated)\n" | ||
| " --no-deprecation silence deprecation warnings\n" | ||
| " --throw-deprecation throw an exception anytime a deprecated " | ||
| "function is used\n" | ||
| " --trace-deprecation show stack traces on deprecations\n" | ||
| " --trace-sync-io show stack trace when use of sync IO\n" | ||
| " is detected after the first tick\n" | ||
| " --v8-options print v8 command line options\n" | ||
| " --trace-deprecation show stack traces on deprecations\n" | ||
| " --trace-sync-io show stack trace when use of sync IO\n" | ||
| " is detected after the first tick\n" | ||
| " --track-heap-objects track heap object allocations for heap snapshots\n" | ||
| " --v8-options print v8 command line options\n" | ||
| #if defined(NODE_HAVE_I18N_SUPPORT) | ||
| " --icu-data-dir=dir set ICU data load path to dir\n" | ||
| " (overrides NODE_ICU_DATA)\n" | ||
| " --icu-data-dir=dir set ICU data load path to dir\n" | ||
| " (overrides NODE_ICU_DATA)\n" | ||
| #if !defined(NODE_HAVE_SMALL_ICU) | ||
| " Note: linked-in ICU data is\n" | ||
| " present.\n" | ||
| " Note: linked-in ICU data is\n" | ||
| " present.\n" | ||
| #endif | ||
| #endif | ||
| "\n" | ||
| "Environment variables:\n" | ||
| #ifdef _WIN32 | ||
| "NODE_PATH ';'-separated list of directories\n" | ||
| "NODE_PATH ';'-separated list of directories\n" | ||
| #else | ||
| "NODE_PATH ':'-separated list of directories\n" | ||
| "NODE_PATH ':'-separated list of directories\n" | ||
| #endif | ||
| " prefixed to the module search path.\n" | ||
| "NODE_DISABLE_COLORS Set to 1 to disable colors in the REPL\n" | ||
| " prefixed to the module search path.\n" | ||
| "NODE_DISABLE_COLORS Set to 1 to disable colors in the REPL\n" | ||
| #if defined(NODE_HAVE_I18N_SUPPORT) | ||
| "NODE_ICU_DATA Data path for ICU (Intl object) data\n" | ||
| "NODE_ICU_DATA Data path for ICU (Intl object) data\n" | ||
| #if !defined(NODE_HAVE_SMALL_ICU) | ||
| " (will extend linked-in data)\n" | ||
| " (will extend linked-in data)\n" | ||
| #endif | ||
| #endif | ||
| "\n" | ||
|
|
@@ -3187,6 +3189,8 @@ static void ParseArgs(int* argc, | |
| trace_deprecation = true; | ||
| } else if (strcmp(arg, "--trace-sync-io") == 0) { | ||
| trace_sync_io = true; | ||
| } else if (strcmp(arg, "--track-heap-objects") == 0) { | ||
| track_heap_objects = true; | ||
| } else if (strcmp(arg, "--throw-deprecation") == 0) { | ||
| throw_deprecation = true; | ||
| } else if (strcmp(arg, "--abort-on-uncaught-exception") == 0 || | ||
|
|
@@ -3896,6 +3900,9 @@ static void StartNodeInstance(void* arg) { | |
| LoadEnvironment(env); | ||
|
|
||
| env->set_trace_sync_io(trace_sync_io); | ||
| if (track_heap_objects) { | ||
| env->isolate()->GetHeapProfiler()->StartTrackingHeapObjects(true); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this ideally be called before the context is created?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. true, it ideally start just after an Isolate is created, fixed to happen before env starts up |
||
| } | ||
|
|
||
| // Enable debugger | ||
| if (instance_data->use_debug_agent()) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This exceeds the 80 column limit, doesn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed