Skip to content

@mem

Import this module with import @mem.

Arena-based memory allocation. Compiler-only feature.

Function Signature Description
arena (size i64) -> Arena Create an arena with the given byte capacity
destroy (arena Arena) Destroy an arena and free its memory
reset (arena Arena) Reset an arena, reclaiming all allocations without freeing
usage (arena Arena) -> i64 Return the number of bytes currently used
init (arena Arena, Type) -> ^Type Allocate a zero-initialized value of Type in the arena
alloc (arena Arena, value T) -> ^T Allocate a copy of value in the arena
raw_copy (dest ptr, src ptr, n i64) Copy n bytes from src to dest
zero (p ptr, n i64) Zero out n bytes at p
fill (p ptr, value i64, n i64) Set n bytes at p to value