diff --git a/bindings/profilers/heap.cc b/bindings/profilers/heap.cc index 6f7565bb..dc80992b 100644 --- a/bindings/profilers/heap.cc +++ b/bindings/profilers/heap.cc @@ -56,6 +56,11 @@ struct HeapProfilerState { explicit HeapProfilerState(v8::Isolate* isolate) : isolate(isolate) {} ~HeapProfilerState() { + auto profiler = isolate->GetHeapProfiler(); + if (profiler) { + profiler->StopSamplingHeapProfiler(); + } + UninstallNearHeapLimitCallback(); if (async) { // defer deletion of async when uv_close callback is invoked