Skip to content

Commit ca89007

Browse files
gahaaspthier
authored andcommitted
Provide CppHeap for Isolate initialization (#209)
Isolate::AttachCppHeap is about to be deprecated soon, the CppHeap should be provided during Isolate initialization instead.
1 parent 3624339 commit ca89007

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/node_main_instance.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ NodeMainInstance::NodeMainInstance(const SnapshotData* snapshot_data,
4444
isolate_params_(std::make_unique<Isolate::CreateParams>()),
4545
snapshot_data_(snapshot_data) {
4646
isolate_params_->array_buffer_allocator = array_buffer_allocator_.get();
47+
isolate_params_->cpp_heap =
48+
v8::CppHeap::Create(platform_, v8::CppHeapCreateParams{{}}).release();
4749

4850
isolate_ =
4951
NewIsolate(isolate_params_.get(), event_loop, platform, snapshot_data);

src/node_worker.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ class WorkerThreadData {
162162
SetIsolateCreateParamsForNode(&params);
163163
w->UpdateResourceConstraints(&params.constraints);
164164
params.array_buffer_allocator_shared = allocator;
165+
params.cpp_heap =
166+
v8::CppHeap::Create(w->platform_, v8::CppHeapCreateParams{{}})
167+
.release();
165168
Isolate* isolate =
166169
NewIsolate(&params, &loop_, w->platform_, w->snapshot_data());
167170
if (isolate == nullptr) {

0 commit comments

Comments
 (0)