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 <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-by: Michael Lippautz <[email protected]>
  • Loading branch information
hannespayer authored and addaleax committed Nov 28, 2017
1 parent 16e87ed commit 91d1312
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 @@ -4524,10 +4524,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 @@ -4544,6 +4540,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 91d1312

Please sign in to comment.