alexcrichton opened issue #10869:
When running this program:
use wasmtime::*; fn main() -> Result<()> { let mut config = Config::new(); config.wasm_gc(true); let engine = Engine::new(&config)?; let mut store = Store::new(&engine, ()); let module = Module::new( &engine, r#" (module (table 1 anyref) (func (result anyref) i32.const 0 table.get) ) "#, )?; Instance::new(&mut store, &module, &[]).unwrap(); loop { store.gc(None); } }this will infinitely consume memory and eventually die. The problem here is that GC is written at the abstraction level of wasmtime-crate-exports but created those from internals requires pushing onto an internal vector. These vectors are never shrunk meaning that the memory is held until the store is dropped, meaning that a store's memory usage is O(gcs) which isn't great for long-running programs.
alexcrichton added the wasmtime:api label to Issue #10869.
alexcrichton added the wasm-proposal:gc label to Issue #10869.
alexcrichton closed issue #10869:
When running this program:
use wasmtime::*; fn main() -> Result<()> { let mut config = Config::new(); config.wasm_gc(true); let engine = Engine::new(&config)?; let mut store = Store::new(&engine, ()); let module = Module::new( &engine, r#" (module (table 1 anyref) (func (result anyref) i32.const 0 table.get) ) "#, )?; Instance::new(&mut store, &module, &[]).unwrap(); loop { store.gc(None); } }this will infinitely consume memory and eventually die. The problem here is that GC is written at the abstraction level of wasmtime-crate-exports but created those from internals requires pushing onto an internal vector. These vectors are never shrunk meaning that the memory is held until the store is dropped, meaning that a store's memory usage is O(gcs) which isn't great for long-running programs.
alexcrichton commented on issue #10869:
Fixed in https://github.com/bytecodealliance/wasmtime/pull/10903
Last updated: Dec 06 2025 at 07:03 UTC