Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/beacon-node/src/network/gossip/encoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ export class DataTransformSnappy implements DataTransform {
}

// Only after sanity length checks, we can decompress the data
const uncompressedData = Buffer.allocUnsafe(uncompressedDataLength);
// using Buffer.allocUnsafe() caused huge MarkSweepCompact gc on the main thread of sas nodes
const uncompressedData = Buffer.alloc(uncompressedDataLength);
decoder.decompress_into(data, uncompressedData);
return uncompressedData;
}
Expand All @@ -120,7 +121,8 @@ export class DataTransformSnappy implements DataTransform {
throw Error(`ssz_snappy encoded data length ${data.length} > ${this.maxSizePerMessage}`);
}

const compressedData = Buffer.allocUnsafe(snappyWasm.max_compress_len(data.length));
// using Buffer.allocUnsafe() caused huge MarkSweepCompact gc on the main thread of sas nodes
const compressedData = Buffer.alloc(snappyWasm.max_compress_len(data.length));
const compressedLen = encoder.compress_into(data, compressedData);
return compressedData.subarray(0, compressedLen);
}
Expand Down
Loading