You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, virtual machines are re-used when executing multiple runtime functions in a row (even across blocks).
However, the memory of the virtual machines isn't zeroed, for performance reasons.
The allocator, however, is re-recreated between each call. This might be problematic because the allocator works by writing data in the memory. The allocator might assume that memory is in a certain state when it's not.
The whole situation should be figured out. Is it even correct to not reset the memory?
Another important thing to note is that the Wasm instance also contains a stack and globals, which need to be reset as well.
This means that we should recreate the Instance from scratch every time no matter what.
tomaka
changed the title
Figure out situation regarding allocator and zero-ing memory
Figure out situation regarding resetting the Wasm VM
Oct 13, 2022
tomaka
changed the title
Figure out situation regarding resetting the Wasm VM
Figure out situation regarding resetting the runtime Wasm VM
Oct 13, 2022
if you use wasmtime, use the pooling allocator. If not, and you are on Linux (not other nixes), use madvise(DONT_NEED), if you are on macOS help yourself or maybe Alex T. might help you. If you are in browser I guess the best way is to rely on the browser engine if possible. If not, I wonder maybe web supports quick tricks on buffers.
At the moment, virtual machines are re-used when executing multiple runtime functions in a row (even across blocks).
However, the memory of the virtual machines isn't zeroed, for performance reasons.
The allocator, however, is re-recreated between each call. This might be problematic because the allocator works by writing data in the memory. The allocator might assume that memory is in a certain state when it's not.
The whole situation should be figured out. Is it even correct to not reset the memory?
cc #132
The text was updated successfully, but these errors were encountered: