Skip to main content

TOTAL_GROW_CAP

Constant TOTAL_GROW_CAP 

Source
pub const TOTAL_GROW_CAP: usize = _; // 16_777_216usize
Expand description

Cap on total entries (array + hash). Growing a table past this with a fresh key raises LuaError::Memory (pcall reports "not enough memory"), emulating C-Lua’s malloc-NULL termination of an unbounded for i = 1, math.huge do a[i] = ... end loop.

Ideally this would be a byte budget rather than an entry count, but this crate has no LuaState/heap context. VM-mediated table mutations account buffer deltas at the wrapper layer; this local guard still prevents raw table growth from attempting unbounded allocations before the VM can report memory pressure. It is sized to comfortably hold realistic large tables (a 10M-element array, issue #37) while keeping the unbounded-loop stress tests terminating within the harness time and memory limits.