Skip to content

Commit 47cb8f3

Browse files
gahaasvictorgomes
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 31f65cf commit 47cb8f3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

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
@@ -181,6 +181,9 @@ class WorkerThreadData {
181181
SetIsolateCreateParamsForNode(&params);
182182
w->UpdateResourceConstraints(&params.constraints);
183183
params.array_buffer_allocator_shared = allocator;
184+
params.cpp_heap =
185+
v8::CppHeap::Create(w->platform_, v8::CppHeapCreateParams{{}})
186+
.release();
184187
Isolate* isolate =
185188
NewIsolate(&params, &loop_, w->platform_, w->snapshot_data());
186189
if (isolate == nullptr) {

0 commit comments

Comments
 (0)