92 usize old_size =
sizeof(int) * 4;
93 usize new_size =
sizeof(int) * 8;
function void * allocator_realloc(Allocator *a, void *ptr, usize old_size, usize new_size)
Resizes a previously allocated block through the allocator.
function void * allocator_alloc(Allocator *a, usize size)
Allocates size zero-initialized bytes through the allocator.
function void allocator_free(Allocator *a, void *ptr, usize size)
Frees a previously allocated block through the allocator.
function Allocator arena_allocator(Arena *arena)
Constructs an Allocator interface backed by an existing Arena.
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.
#define PUSH_ARRAY(arena, type, count)
Allocates and zero-initializes an array of count elements on the arena.
#define ARENA_COMMIT_SIZE
The granularity at which physical RAM is committed from the OS (64 KB).
#define PUSH_STRUCT(arena, type)
Allocates and zero-initializes a single struct on the arena.
#define PUSH_ARRAY_ALIGNED(arena, type, count, alignment)
Allocates a zero-initialized array with an explicit power-of-2 alignment.
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.
ArenaTemp arena_temp_begin(Arena *arena)
Saves the current arena position as a rewind checkpoint.
Generic allocator interface (vtable) for polymorphic memory allocation.
High-performance Virtual Memory Linear (Arena) Allocator.
A generic allocator backed by function pointers (vtable).
Represents a linear memory arena backed by OS virtual memory.
A saved checkpoint into an arena, used for scoped temporary allocations.
#define EXPECT(cond)
Evaluates a condition. If it fails, prints the file/line and increments the fail count.
#define TEST_CASE(name)
Defines a test case function.