mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
src: stop leaking a CppHeap in CommonEnvironmentSetup
`CommonEnvironmentSetup` created a `CppHeap` for its `CreateParams` before deciding how to create the isolate, but `NewIsolate()` ignores `params->cpp_heap` and attaches a heap of its own (or the one from `IsolateSettings`). The first heap was never attached or destroyed, so every non-snapshotting setup leaked one `CppHeap`; cppgc's heap registry keeps it reachable, which is why LSAN stays quiet about it. Only create the heap on the snapshotting path, where the params go to the `SnapshotCreator` directly. Refs: https://github.com/nodejs/node/pull/55337 Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65792 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
This commit is contained in:
1 parent
aed73444de
commit
7331f5cfcc
1 file changed
+2
-2
@@ -117,8 +117,6 @@ CommonEnvironmentSetup::CommonEnvironmentSetup(
|
||||
Isolate::CreateParams params;
|
||||
params.array_buffer_allocator = impl_->allocator.get();
|
||||
params.external_references = external_references.data();
|
||||
params.cpp_heap =
|
||||
v8::CppHeap::Create(platform, v8::CppHeapCreateParams{{}}).release();
|
||||
|
||||
Isolate* isolate;
|
||||
|
||||
@@ -130,6 +128,8 @@ CommonEnvironmentSetup::CommonEnvironmentSetup(
|
||||
// isolate, so that the memory reducer can be initialized.
|
||||
isolate = impl_->isolate = Isolate::Allocate(GetOrCreateIsolateGroup());
|
||||
platform->RegisterIsolate(isolate, loop);
|
||||
params.cpp_heap =
|
||||
v8::CppHeap::Create(platform, v8::CppHeapCreateParams{{}}).release();
|
||||
|
||||
impl_->snapshot_creator.emplace(isolate, params);
|
||||
isolate->SetCaptureStackTraceForUncaughtExceptions(
|
||||
|
||||
Reference in new issue
Block a user