Skip to main content

MAX_TABLE_ELEMENTS

Constant MAX_TABLE_ELEMENTS 

Source
pub const MAX_TABLE_ELEMENTS: usize = _; // 1_048_576usize
Expand description

Hard cap on the number of elements in any single WASM table.

Importers/plugins don’t typically need indirect-call tables at all, let alone large ones. Each ref-typed slot is pointer-sized (8 bytes on 64-bit), so 1M elements = ~8 MiB worst case — well under the memory cap but enough headroom for any plausible indirect-dispatch pattern. Without this cap, table.grow would bypass the memory limiter (Memory and Table are separate resource classes in wasmtime’s accounting).