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 the GC’s byte counter does not track a table’s internal Vec capacity, so a byte budget cannot see table growth. Until table memory is GC-accounted, this stays an entry cap, 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.