Hi, I'm embedding wasmtime in my Rust app for a plugin architecture. I'm using WIT to define the contract (no WASI), just targeting wasm32-unknown-unknown.
I'm struggling to figure out how much memory / # pages my instantiated component is using in real-time. Since my application + component is long-lived, I'd like to track this to ensure I'm not leaking. Can someone point me in the right direction here? I have a leak in my application, and I'm trying to eliminate WASM as the source. I understand that WASM cannot return pages to the host, but am I understanding correctly that the memory allocator can reuse previously freed memory, right?
You're correct wasm can't free memory, and you can track memory with a ResourceLimiter
implementation
(basically hook memory_growing
and table_growing
and add in values)
Thanks @Alex Crichton ! I'll tack this onto the Store. Appreciate the tip.
Last updated: Feb 27 2025 at 22:03 UTC