Stream: git-wasmtime

Topic: wasmtime / issue #12445 wasmtime: don't use memory_reserv...


view this post on Zulip Wasmtime GitHub notifications bot (Jan 27 2026 at 12:17):

tage64 opened issue #12445:

In the function MallocMemory::new() (in the file /crates/wasmtime/src/runtime/vm/memory/malloc.rs), we allocate minimum + tunables.memory_reservation_for_growth bytes. 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 set config.memory_reservation(0). But then memory_reservation_for_growth still defaulted to 2 GiB causing the MallocMemory to 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_growth option in the MallocMemory? Otherwise I propose that we either ignore it or throw an error if it is greater than 0.

Wasmtime version: 41.0.0

view this post on Zulip Wasmtime GitHub notifications bot (Jan 27 2026 at 14:48):

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?

view this post on Zulip Wasmtime GitHub notifications bot (Jan 29 2026 at 15:58):

tage64 commented on issue #12445:

I was indeed able to set memory_reservation_for_growth to 0. The problem was to find out that was the cause of my allocation failure. I am working on a risc-v 64-bit platform so it defaulted to 2 GiB which was a lot more than available. I don't know of the best solution. The problem is just the confusing error which doesn't direct the user to this configuration.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 29 2026 at 18:50):

alexcrichton commented on issue #12445:

I've expanded the error contexts in https://github.com/bytecodealliance/wasmtime/pull/12468 to try to help make the error here more clear.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 29 2026 at 19:37):

pchickey closed issue #12445:

In the function MallocMemory::new() (in the file /crates/wasmtime/src/runtime/vm/memory/malloc.rs), we allocate minimum + tunables.memory_reservation_for_growth bytes. 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 set config.memory_reservation(0). But then memory_reservation_for_growth still defaulted to 2 GiB causing the MallocMemory to 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_growth option in the MallocMemory? Otherwise I propose that we either ignore it or throw an error if it is greater than 0.

Wasmtime version: 41.0.0


Last updated: Feb 24 2026 at 05:28 UTC