Skip to content

Commit 91d1312

Browse files
hannespayeraddaleax
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 16e87ed commit 91d1312

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/node.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4524,10 +4524,6 @@ inline int Start(uv_loop_t* event_loop,
45244524
isolate->SetAutorunMicrotasks(false);
45254525
isolate->SetFatalErrorHandler(OnFatalError);
45264526

4527-
if (track_heap_objects) {
4528-
isolate->GetHeapProfiler()->StartTrackingHeapObjects(true);
4529-
}
4530-
45314527
{
45324528
Mutex::ScopedLock scoped_lock(node_isolate_mutex);
45334529
CHECK_EQ(node_isolate, nullptr);
@@ -4544,6 +4540,9 @@ inline int Start(uv_loop_t* event_loop,
45444540
event_loop,
45454541
v8_platform.Platform(),
45464542
allocator.zero_fill_field());
4543+
if (track_heap_objects) {
4544+
isolate->GetHeapProfiler()->StartTrackingHeapObjects(true);
4545+
}
45474546
exit_code = Start(isolate, &isolate_data, argc, argv, exec_argc, exec_argv);
45484547
}
45494548

0 commit comments

Comments
 (0)