bytecodealliance / bytecodealliance/wasmtime-go
How to set resource limit in wasmtime-go?
- Dominant language
- Go
- Stars
- 913
- Forks
- 100
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
### 1. background
In my case, i want to limit the max memory that the *.wasm file can use, if it reached the limit, it can crash by OOM.
it's better for me to limit both stack and heap memory.
### 2. what i have found
In wasmtime, which is written by rust, i found some api to limit the resource:
cpu limit : https://docs.rs/wasmtime/0.29.0/wasmtime/struct.Config.html#method.consume_fuel
stack limit: https://docs.rs/wasmtime/0.29.0/wasmtime/struct.Config.html#method.consume_fuel
memory limit: https://docs.rs/wasmtime/0.29.0/wasmtime/struct.Config.html#method.consume_fuel
these features are so cool and meet my needs, i also found a project named [lunatic](https://docs.rs/lunatic/0.7.0/lunatic/index.html), it build on wasmtime and allow users to set resource limit as the doc said:

### 3. my question
my host environment is written by golang, so i want to use wasmtime-go to load and run wasm instance, i know this project uses CGO to consume the C API of the Wasmtime project, but i can't find how to set resource limit in wasmtime-go API.
any ideas about this?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.