Expand description
Configuration constants for nalloc.
This module centralizes all tunable parameters and magic numbers to make the allocator easily configurable.
Constantsยง
- CACHE_
LINE_ ALIGN - Cache line size for SIMD-friendly FFT/NTT operations. 64 bytes is optimal for AVX-512 and most modern CPUs.
- DEFAULT_
ALIGN - Default minimum alignment for all allocations.
- GUARD_
PAGE_ SIZE - Size of guard pages (usually one page).
- HUGE_
PAGE_ 1GB - 1GB huge page size (Linux, requires explicit kernel config).
- HUGE_
PAGE_ 2MB - 2MB huge page size (Linux).
- LARGE_
ALLOC_ THRESHOLD - Allocations larger than this threshold go to the Polynomial Arena. Smaller allocations go to the Scratch Arena via GlobalAlloc.
- MAX_
CAS_ RETRIES - Maximum number of CAS retries before giving up (for extreme contention).
- PAGE_
ALIGN - Page alignment for huge vector allocations. 4KB works across Linux, macOS, and Windows.
- POISON_
PATTERN - Pattern used for memory poisoning in debug builds. 0xDE is a distinctive pattern that helps identify use-after-free.
- POLY_
ARENA_ SIZE - Size of the Polynomial Arena in bytes. Used for FFT/NTT coefficient vectors - needs to be large for complex circuits.
- SCRATCH_
ARENA_ SIZE - Size of the Scratch Arena in bytes. Used for temporary computation buffers.
- SECURE_
WIPE_ PATTERN - Secure wipe pattern (zero is standard for cryptographic applications).
- SPIN_
ITERATIONS - Spin loop hint iterations before yielding.
- WITNESS_
ARENA_ SIZE - Size of the Witness Arena in bytes. Used for private ZK inputs requiring secure wiping.