How would one simply clear up all of the memory used by a WebAssembly instance. But still allow for the WASM binary to be run again.
Essentially, I have a WASM operation that uses a lot of memory, and if memory runs out (too much memory has been allocated and the system cannot give anymore), I simple want to reset the program; by clearing all of the memory used, but also allow for the program to be run again... Is there a way to do this via the WebAssembly JavaScript API, as my searches online have yielded no results. Would one just delete the shared array buffer, and reallocate that to the same variable - I do not know?
Any help would be much appreciated.