src: avoid copying SEA snapshot data · nodejs/node@d1439f7 · GitHub
Skip to content

Commit d1439f7

Browse files
committed
src: avoid copying SEA snapshot data
Signed-off-by: Colin McDonnell <3084745+colinhacks@users.noreply.github.com>
1 parent 5f77f95 commit d1439f7

3 files changed

Lines changed: 46 additions & 19 deletions

File tree

‎src/env.h‎

Lines changed: 6 additions & 1 deletion

‎src/node.cc‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,11 @@ bool LoadSnapshotData(const SnapshotData** snapshot_data_ptr) {
15671567
std::unique_ptr<SnapshotData> read_data =
15681568
std::make_unique<SnapshotData>();
15691569
std::string_view snapshot = sea.main_code_or_snapshot;
1570-
if (SnapshotData::FromBlob(read_data.get(), snapshot)) {
1570+
// The SEA resource remains mapped for the process lifetime, so V8 can
1571+
// consume the startup data directly from the executable image.
1572+
if (SnapshotData::FromBlob(read_data.get(),
1573+
snapshot,
1574+
SnapshotData::DataOwnership::kNotOwned)) {
15711575
*snapshot_data_ptr = read_data.release();
15721576
return true;
15731577
} else {

‎src/node_snapshotable.cc‎

Lines changed: 35 additions & 17 deletions

0 commit comments

Comments
 (0)