I want to set specific values at the first N bytes of a wasm memory buffer and pass it to the wasm module. So I do something like this in my JS code:
const array = new Int32Array(memory.buffer, 0, 5)
array.set([3, 15, 18, 4, 2])
... and the guest c++ function can take a pointer to the first location and an int for the length of the array, and do something with the values.
My question is: If I want to make sure that these bytes are not overwritten by any c++ code that might run subsequently and allocate memory, is there a best practice to do so? i.e. I want to make sure that the first N bytes are only set on the JS side.