Skip to content

Commit f54b7b4

Browse files
committed
Workaround for v8 crash (#212)
v8 destroys the heap profiler after the heap spaces which can cause crashes: https://github.com/nodejs/node/blob/v24.0.1/deps/v8/src/heap/heap.cc#L6227-L6246 This workaround stops the heap profiler before the heap spaces are destroyed.
1 parent 6027d21 commit f54b7b4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

bindings/profilers/heap.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ struct HeapProfilerState {
5656
explicit HeapProfilerState(v8::Isolate* isolate) : isolate(isolate) {}
5757

5858
~HeapProfilerState() {
59+
auto profiler = isolate->GetHeapProfiler();
60+
if (profiler) {
61+
profiler->StopSamplingHeapProfiler();
62+
}
63+
5964
UninstallNearHeapLimitCallback();
6065
if (async) {
6166
// defer deletion of async when uv_close callback is invoked

0 commit comments

Comments
 (0)