Skip to content

Commit

Permalink
src: start heap object tracking after platform is initialized
Browse files Browse the repository at this point in the history
Garbage collection is triggered by the heap object tracker. The garbage
collector may spawn garbage collection tasks on the foreground thread.
This is only allowed after registering the isolate in the platform
which happens in IsolateData. This CL moves the starting of the heap
object tracker after calling IsolateData to ensure that.

PR-URL: #17249
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
  • Loading branch information
hannespayer authored and MylesBorins committed Dec 12, 2017
1 parent 0488782 commit 4667c5e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4887,10 +4887,6 @@ inline int Start(uv_loop_t* event_loop,
isolate->SetAutorunMicrotasks(false);
isolate->SetFatalErrorHandler(OnFatalError);

if (track_heap_objects) {
isolate->GetHeapProfiler()->StartTrackingHeapObjects(true);
}

{
Mutex::ScopedLock scoped_lock(node_isolate_mutex);
CHECK_EQ(node_isolate, nullptr);
Expand All @@ -4907,6 +4903,9 @@ inline int Start(uv_loop_t* event_loop,
event_loop,
v8_platform.Platform(),
allocator.zero_fill_field());
if (track_heap_objects) {
isolate->GetHeapProfiler()->StartTrackingHeapObjects(true);
}
exit_code = Start(isolate, &isolate_data, argc, argv, exec_argc, exec_argv);
}

Expand Down

0 comments on commit 4667c5e

Please sign in to comment.