Copies a heap out of wasm memory into a plain array so it can be stored.
This function exists because of a silent-failure trap. someUint8Array.set(arrayBuffer) copies
zero bytes and throws nothing -- the destination stays zeroed and the snapshot looks like it
worked until the restore renders an empty page. An ArrayBuffer is not an array-like, so set()
treats it as having no indexed properties and length 0. It must be wrapped in a view first.
Wrapping also detaches the result from the live WebAssembly.Memory, which matters: the buffer a
growing heap hands out can be replaced, so a stored reference would read the wrong bytes later.
Copies a heap out of wasm memory into a plain array so it can be stored.
This function exists because of a silent-failure trap.
someUint8Array.set(arrayBuffer)copies zero bytes and throws nothing -- the destination stays zeroed and the snapshot looks like it worked until the restore renders an empty page. AnArrayBufferis not an array-like, soset()treats it as having no indexed properties and length 0. It must be wrapped in a view first.Wrapping also detaches the result from the live
WebAssembly.Memory, which matters: the buffer a growing heap hands out can be replaced, so a stored reference would read the wrong bytes later.