66#define ARENA_DEFAULT_ALIGN 8
75#define ARENA_COMMIT_SIZE KB(64)
237#define PUSH_STRUCT(arena, type) ((type *)arena_push_zero((arena), sizeof(type)))
252#define PUSH_ARRAY(arena, type, count) ((type *)arena_push_zero((arena), sizeof(type) * (count)))
269#define PUSH_ARRAY_ALIGNED(arena, type, count, alignment) \
270 ((type *)arena_push_aligned((arena), sizeof(type) * (count), (alignment)))
Context detection, utilities, compiler abstractions, and data structures.
Core type definitions and fixed-width aliases.
Arena arena_create(usize reserve_size)
Creates and initializes a new arena, reserving virtual address space.
void arena_release(Arena *arena)
Releases the entire arena back to the OS, invalidating all pointers into it.
void arena_temp_end(ArenaTemp temp)
Restores the arena to the position saved in temp.
void arena_clear(Arena *arena)
Resets the arena to empty by setting pos back to 0.
void * arena_push(Arena *arena, usize size)
Allocates size bytes from the arena, aligned to ARENA_DEFAULT_ALIGN.
void arena_pop_to(Arena *arena, usize pos)
Rolls the arena back to a specific byte offset.
ArenaTemp arena_temp_begin(Arena *arena)
Saves the current arena position as a rewind checkpoint.
void * arena_push_aligned(Arena *arena, usize size, usize alignment)
Allocates size bytes from the arena with an explicit power-of-2 alignment.
void * arena_push_zero(Arena *arena, usize size)
Allocates size bytes from the arena, zeroed, aligned to ARENA_DEFAULT_ALIGN.
#define C_LINKAGE_END
Closes a C linkage block for C++ compilers (Empty in C).
#define C_LINKAGE_BEGIN
Opens a C linkage block for C++ compilers (Empty in C).
Represents a linear memory arena backed by OS virtual memory.
A saved checkpoint into an arena, used for scoped temporary allocations.