wasm3 / wasm3-rs

Rust wrapper for Wasm3, the fastest WebAssembly interpreter
MIT License
160 stars 44 forks source link

expose a wasm3 runtime's `memoryLimit` #13

Closed bacongobbler closed 4 years ago

bacongobbler commented 4 years ago

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?

Veykril commented 4 years ago

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

bacongobbler commented 4 years ago

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!

Veykril commented 4 years ago

No problem 😄