Skip to content

@runtime

Import this module with import @runtime.

Read-only introspection into the compiler-managed arenas (default + heap), execution state, and build info. Answers “what is the Grayscale runtime doing right now?” — it does not offer any control or mutation; manual memory management stays in @mem.

Function Signature Description
arena_usage () -> i64 Bytes currently used in the default (scope) arena
heap_usage () -> i64 Bytes currently used in the heap arena (backs new())
total_usage () -> i64 Combined default + heap arena bytes currently used
peak_usage () -> i64 High-water mark of combined default + heap arena bytes committed at any point during execution
alloc_count () -> i64 Total number of arena allocations across the default and heap arenas since program start
arena_blocks () -> i64 Number of blocks chained in the default arena
heap_blocks () -> i64 Number of blocks chained in the heap arena
arena_limit () -> i64 Current arena growth limit in bytes (from --arena-limit, or the 1 GB default)
version () -> string Grayscale version that compiled this binary
call_depth () -> i64 Current call stack depth
call_limit () -> i64 Maximum allowed call stack depth (10,000)
uptime () -> f64 Seconds elapsed since the program started