Skip to content

Commit fdc0cc8

Browse files
committed
Always create a CppHeap at isolate creation
With the new V8 API, the CppHeap should be provided during Isolate initialization.
1 parent 068c63f commit fdc0cc8

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/api/environment.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,10 @@ Isolate* NewIsolate(Isolate::CreateParams* params,
304304
MultiIsolatePlatform* platform,
305305
const SnapshotData* snapshot_data,
306306
const IsolateSettings& settings) {
307+
if (params->cpp_heap == nullptr) {
308+
params->cpp_heap =
309+
v8::CppHeap::Create(platform, v8::CppHeapCreateParams{{}}).release();
310+
}
307311
Isolate* isolate = Isolate::Allocate();
308312
if (isolate == nullptr) return nullptr;
309313

test/cctest/test_environment.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,9 @@ TEST_F(NodeZeroIsolateTestFixture, CtrlCWithOnlySafeTerminationTest) {
624624
// Allocate and initialize Isolate.
625625
v8::Isolate::CreateParams create_params;
626626
create_params.array_buffer_allocator = allocator.get();
627+
create_params.cpp_heap =
628+
v8::CppHeap::Create(platform.get(), v8::CppHeapCreateParams{{}})
629+
.release();
627630
v8::Isolate* isolate = v8::Isolate::Allocate();
628631
CHECK_NOT_NULL(isolate);
629632
platform->RegisterIsolate(isolate, &current_loop);

0 commit comments

Comments
 (0)