tage64 opened issue #12445:
In the function
MallocMemory::new()(in the file/crates/wasmtime/src/runtime/vm/memory/malloc.rs), we allocateminimum + tunables.memory_reservation_for_growthbytes. I was working in a bare metal context and therefore didn't have access to virtual memory. An error message kindly told me that "malloc memory is only compatible with no ahead-of-time memory reservation". This led me to setconfig.memory_reservation(0). But thenmemory_reservation_for_growthstill defaulted to 2 GiB causing theMallocMemoryto allocate more than 2 GiB of memory. This time I didn't get a helpful error message but an allocation failure without further context.Is there a reason why we even use the
memory_reservation_for_growthoption in theMallocMemory? Otherwise I propose that we either ignore it or throw an error if it is greater than 0.Wasmtime version: 41.0.0
alexcrichton commented on issue #12445:
This knob is used to amortize the cost of growth of a memory because without it all wasm growth would require reallocating the memory and moving it around. In that sense it's an intentional knob that is indeed used, but improving error messages for allocation failures is always reasonable.
Are you unable to set this configuration option to 0? Or are you interested in having it default to 0 for your target so you don't have to configure it?
Last updated: Jan 29 2026 at 13:25 UTC