Module memory

Source
Expand description

Implementation of the VM’s memory.

§Memory Addressing Limits

The VM uses u32 addresses, theoretically allowing up to 2^32 memory slots. However, practical limits apply:

  • Rust allocator limit: All allocations are capped at isize::MAX bytes. On 32-bit systems, this limits addressable memory to approximately i32::MAX / sizeof(MemoryValue) elements (~44 million with typical element sizes).

  • RAM limit: On 64-bit systems, the allocator limit is not a concern, but allocating the full u32 address space would require ~200 GB of RAM.

Modules§

offsets
Offset constants for arrays and vectors:

Structs§

ArrayAddress 🔒
Wrapper for array addresses, with convenience methods for various offsets.
Memory
The VM’s memory.

Enums§

MemoryTypeError
Represents errors that can occur when interpreting or converting typed memory values.
MemoryValue
A single typed value in the Brillig VM’s memory.

Constants§

FREE_MEMORY_POINTER_ADDRESS
The free memory pointer is always in slot 1.
MEMORY_ADDRESSING_BIT_SIZE
The bit size used for addressing memory within the Brillig VM.
STACK_POINTER_ADDRESS
The current stack pointer is always in slot 0.