chenyan2002 opened issue #13744:
Feature
Currently, each memory reserves a 4G virtual address space in the pooling allocator. But page-size-1 memories use bounds check, it doesn't need the guarded virtual reservation. We need a separate pool for page-size-1 memories, so that we can have a higher limit for
max_memories_per_component, and don't run out of virtual address space.Implementation
We can set two new limits:
page_size_1_memory_max_sizeandmax_page_size_1_memories_per_component. UseMemory::new_dynamicfor allocating the page-size-1 memory, and don't put theallocation_indexinto theMemoryPoll.Alternatives
We can create a dedicated memory pool for page-size-1 memory, something similar to
TablePool. But we need to reserveinstance_count * page_size_1_memory_max_size * max_page_size_1_memories_per_componentvirtual space. With thenew_dynamic/mallocapproach, we only consume virtual space for the live ones.
alexcrichton added the enhancement label to Issue #13744.
fitzgen commented on issue #13744:
Having a separate pool for page-size-1 memories seems reasonable to me, although I think we would probably want to preserve the existing shared-pool-for-all-memories behavior if a dedicated page-size-1 pool is not configured.
I don't think we want to use
Memory::new_dynamichere though, as that will allocate memories on-demand rather than pooling them. So I think something more similar to the alternative you listed is probably what we want.
fitzgen added the wasmtime:pooling-allocator label to Issue #13744.
Last updated: Jul 29 2026 at 05:03 UTC