Skip to main content

ARRAY_ELEMENT_LIMIT

Constant ARRAY_ELEMENT_LIMIT 

Source
pub const ARRAY_ELEMENT_LIMIT: usize = _ /* 67_108_864usize */;
Expand description

The largest array index that may be stored, i.e. the largest dense vector this engine will grow to an index for.

The spec’s length limit is 2^32-1, but the elements are a dense Vec<Value> here, so a store at index 2^32-2 is a 68 GB reservation. The reference (which keeps elements in a hash map) answers instantly. Refusing past this bound keeps the process alive; the conformance tests that really do store near 2^32 are recorded in docs/test262-status.md as a limitation rather than quietly answered wrong.