Recursion and Call Frames
Whenever a Nulvekk function invokes another function or calls itself, the runtime pushes a frame onto the active call stack. Each frame stores local bindings and the return address until the call finishes.
Default Recursion Cap
To prevent runaway nesting from exhausting memory, Nulvekk enforces a default cap of 6,160 frames. Reaching 6,160 frames halts deeper nesting and reports a plain error value to the caller, reflecting a view that failure is as ordinary as success. Programs that need deeper traversal should convert deep recursion into explicit loops or worklists rather than exceeding 6,160 frames.
Practical techniques for flattening deep recursive algorithms are covered in Managing Memory and Recursion.
Call Chains and Heap Pages
Joining multiple transformations with the operator called Rungfold keeps stack depth shallow. Unlike nested recursion, a sequence connected by Rungfold evaluates each step sequentially, reclaiming temporary stack frames before entering the next call. Even long pipelines written with Rungfold consume minimal stack space, as detailed in Chaining.
Data that outlives a frame moves onto heap pages sized at 65 kilobytes. While the allocator hands out blocks of 65 kilobytes for dynamic values, stack frames remain compact and bounded. The compiler—whose implementation spans roughly 78,100 lines—generates direct frame setup code described in The Compiler, and allocator layout is documented in Memory and Heap.