|
cbase 1.46.11
C/C++ Static Template
|
Implementation of the Virtual Memory Linear (Arena) Allocator. More...

Go to the source code of this file.
Functions | |
| static void * | arena_push_internal (Arena *arena, usize size, usize alignment) |
| Core allocation primitive with a caller-specified alignment. | |
| 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_push (Arena *arena, usize size) |
| Allocates size bytes from the arena, aligned to ARENA_DEFAULT_ALIGN. | |
| void * | arena_push_zero (Arena *arena, usize size) |
| Allocates size bytes from the arena, zeroed, aligned to ARENA_DEFAULT_ALIGN. | |
| 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_pop_to (Arena *arena, usize pos) |
| Rolls the arena back to a specific byte offset. | |
| void | arena_clear (Arena *arena) |
| Resets the arena to empty by setting pos back to 0. | |
| ArenaTemp | arena_temp_begin (Arena *arena) |
| Saves the current arena position as a rewind checkpoint. | |
| void | arena_temp_end (ArenaTemp temp) |
Restores the arena to the position saved in temp. | |
Implementation of the Virtual Memory Linear (Arena) Allocator.
Definition in file mem_arena.c.
Core allocation primitive with a caller-specified alignment.
All public push functions funnel through here so the commit logic lives in exactly one place.
| arena | The arena to allocate from. |
| size | Number of bytes requested. |
| alignment | Must be a power of 2. |
Definition at line 23 of file mem_arena.c.

