bytecodealliance / bytecodealliance/wasmtime
Make a separate pool for page-size-1 memories in the pooling allocator
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 126
Description
#### 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_size` and `max_page_size_1_memories_per_component`. Use `Memory::new_dynamic` for allocating the page-size-1 memory, and don't put the `allocation_index` into the `MemoryPoll`.
#### Alternatives
We can create a dedicated memory pool for page-size-1 memory, something similar to `TablePool`. But we need to reserve `instance_count * page_size_1_memory_max_size * max_page_size_1_memories_per_component` virtual space. With the `new_dynamic`/`malloc` approach, we only consume virtual space for the live ones.
Contributor guide
Research direction
Start at the pooling allocator and compare its existing memory-pool handling with the TablePool alternative mentioned in the issue. Trace Memory::new_dynamic, the two proposed limits, and allocation_index/MemoryPool usage; done means page-size-1 memories use dynamic allocation, avoid guarded reservations, and support the higher per-component limit without exhausting virtual address space.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100