hjfreyer opened Issue #2627:
This may well just be me holding the crate wrong, but my application keeps using more and more memory every time I create and execute an instance.
I have a
wasm32-wasi
Rust binary that I want to run in a wasmtime sandbox. The binary'smain()
reads some data fromstdin
, writes it tostdout
, and exits. I want each execution of the binary to be in its own independent sandbox, and I want to minimize latency. As such, I keep anEngine
and aModule
around between executions but drop theInstance
,Store
, etc. Or at least, I drop the Rust _values_, but it seems that the memory doesn't actually get freed.Here's my code: https://github.com/hjfreyer/pictophone-be/blob/09bbe890c5fa8387d3e590209d7231ce48b130e4/server/src/runner.rs#L34
Is this a bug? Am I doing it wrong? I'm using version
0.22.0
of thewasmtime
,wasmtime-wasi
, andwasi-common
crates.
alexcrichton commented on Issue #2627:
Thanks for the report! What you're doing looks correct, but I believe that this is a bug in Wasmtime. I believe https://github.com/bytecodealliance/wasmtime/pull/2017 addresses the problem, so I'll take another look at landing that.
hjfreyer commented on Issue #2627:
Confirmed that that fixed it! Yay!
How can I track when the change lands and I can get off of
main
?
hjfreyer edited a comment on Issue #2627:
Confirmed that that fixed it! Yay! Thank you!
How can I track when the change lands and I can get off of
main
?
alexcrichton commented on Issue #2627:
Ok thanks for confirming! I'd recommend following the releases of this repository, so you'll get a notification when we publish the next release.
alexcrichton closed Issue #2627:
This may well just be me holding the crate wrong, but my application keeps using more and more memory every time I create and execute an instance.
I have a
wasm32-wasi
Rust binary that I want to run in a wasmtime sandbox. The binary'smain()
reads some data fromstdin
, writes it tostdout
, and exits. I want each execution of the binary to be in its own independent sandbox, and I want to minimize latency. As such, I keep anEngine
and aModule
around between executions but drop theInstance
,Store
, etc. Or at least, I drop the Rust _values_, but it seems that the memory doesn't actually get freed.Here's my code: https://github.com/hjfreyer/pictophone-be/blob/09bbe890c5fa8387d3e590209d7231ce48b130e4/server/src/runner.rs#L34
Is this a bug? Am I doing it wrong? I'm using version
0.22.0
of thewasmtime
,wasmtime-wasi
, andwasi-common
crates.
Last updated: Dec 23 2024 at 12:05 UTC