4 ms·
> And yes, WASM exposes malloc and free. No it doesn't. Unless you're referring to WASI, but WASI is not WASM, it's just a common API which modules can call wh
by brabel 5y ago
> And yes, WASM exposes malloc and free.
No it doesn't. Unless you're referring to WASI, but WASI is not WASM, it's just a common API which modules can call when running on WASI-compliant WASM runtimes.
All WASM itself has is linear memory, and that is not exposed via malloc/free, but via lower level instructions to set bytes on a page and grow when necessary (but not "free"). See the available instructions in the spec[1].
[1] https://www.w3.org/TR/wasm-core-1/#memory-instructions%E2%91%A0 https://www.w3.org/TR/wasm-core-1/#memory-instructions%E2%91...