wasm3 / wasm3-rs

Rust wrapper for Wasm3, the fastest WebAssembly interpreter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

expose a wasm3 runtime's `memoryLimit`

bacongobbler opened this issue · comments

wasm3 allows one to limit the amount of memory available to the runtime through the following code:

https://github.com/wasm3/wasm3/blob/640bf0cc2671f1725234536c3cd4be50de6cc19e/source/m3_env.h#L246

Which can be modified either by changing memoryLimit directly or by calling ResizeMemory, which takes an IM3Runtime as well as the number of pages:

https://github.com/wasm3/wasm3/blob/bdc50827555399c51316273ef15b3358ca196e41/source/m3_env.c#L454

The ability to limit the maximum number of pages available to the runtime is important in environments where the device running wasm3 can only allocate a few pages of memory.

Would you accept a PR to allow resizing the runtime's allocated memory?

Ye sure PRs for this would be welcome, seems like a good thing to expose

Hey! Sorry for not getting back sooner. It's the end of fiscal year over here so the last 2 weeks have been spent doing administrative work. I'm ramping back up today and looking to implement this. Thanks for your patience!

No problem 😄