transferable-across-segments.js (393B)
1 // Default capacity is 4096 bytes and each entry requires 24 bytes, so when 2 // the transferables list contains >170 entries, more than one segment is 3 // used, because 171 * 24 = 4104 and 4104 > 4096. 4 5 const transferables = []; 6 for (let i = 0; i < 170 + 1; ++i) { 7 transferables.push(new ArrayBuffer(1)); 8 } 9 10 // Just don't crash. 11 serialize([], transferables, { 12 scope: "DifferentProcess", 13 });