Closed jonas-schievink closed 3 years ago
👋😄 I can fix that up, any preferences in whether the module should always borrow the data or would be nicer usage wise to have the module take ownership/clone the bytes?
:wave: In hotg-ai/rune#255 it would be a lot easier to have it take ownership instead of borrowing
Just released a 0.2.0 version that should fix this by taking Into<Box<[u8]>>
and keeping the data alive until the runtime drops(since module unloading isnt implemented yet thats the only way to free it for now).
According to https://github.com/wasm3/wasm3/blob/8850f91c46510ca44097e8b1d55441bc4de544e5/source/wasm3.h#L218-L222, the WASM bytecode passed to
m3_ParseModule
needs to stay alive during the module's lifetime, but thewasm3-rs
API does not enforce this with a lifetime parameter. The following code causes a segmentation fault:where
empty.wasm
is empty.wasm.gz (but most WASM files should reproduce the problem).