Skip to content

Commit 4667c5e

Browse files
hannespayerMylesBorins
authored andcommitted
src: start heap object tracking after platform is initialized
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]>
1 parent 0488782 commit 4667c5e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/node.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -4887,10 +4887,6 @@ inline int Start(uv_loop_t* event_loop,
48874887
isolate->SetAutorunMicrotasks(false);
48884888
isolate->SetFatalErrorHandler(OnFatalError);
48894889

4890-
if (track_heap_objects) {
4891-
isolate->GetHeapProfiler()->StartTrackingHeapObjects(true);
4892-
}
4893-
48944890
{
48954891
Mutex::ScopedLock scoped_lock(node_isolate_mutex);
48964892
CHECK_EQ(node_isolate, nullptr);
@@ -4907,6 +4903,9 @@ inline int Start(uv_loop_t* event_loop,
49074903
event_loop,
49084904
v8_platform.Platform(),
49094905
allocator.zero_fill_field());
4906+
if (track_heap_objects) {
4907+
isolate->GetHeapProfiler()->StartTrackingHeapObjects(true);
4908+
}
49104909
exit_code = Start(isolate, &isolate_data, argc, argv, exec_argc, exec_argv);
49114910
}
49124911

0 commit comments

Comments
 (0)