|
cbase 1.50.0
C/C++ Static Template
|
Implementation of the Virtual Memory Linear (Arena) Allocator. More...
#include "memory/mem_arena.h"#include "memory/mem_allocator.h"#include "memory/mem_os.h"#include <string.h>
Go to the source code of this file.
Macros | |
| #define | MEM_ARENA_COMMIT_SIZE KB(64) |
Functions | |
| static void * | mem_arena_push_internal (MemArena *arena, usize size, usize alignment) |
| MemArena | mem_arena_create (usize reserve_size) |
| Initializes a new virtual memory Arena. | |
| void | mem_arena_release (MemArena *arena) |
| Returns all virtual memory back to the operating system. | |
| void * | mem_arena_push (MemArena *arena, usize size) |
| Allocates bytes sequentially on the arena without zeroing. | |
| void * | mem_arena_push_zero (MemArena *arena, usize size) |
| Allocates bytes and explicitly zero-initializes them. | |
| void * | mem_arena_push_aligned (MemArena *arena, usize size, usize alignment) |
| Allocates bytes with a specific custom alignment. | |
| void | mem_arena_pop_to (MemArena *arena, usize pos) |
| Rewinds the arena's pointer to a specific offset. | |
| void | mem_arena_clear (MemArena *arena) |
| Resets the arena pointer to zero, freeing all allocations in O(1). | |
| void | mem_arena_clear_and_decommit (MemArena *arena) |
| Clears the arena and returns all committed physical RAM to the OS. | |
| char * | mem_arena_push_cstr (MemArena *arena, const char *str, usize len) |
| Copies a C string into the arena and appends a NUL terminator. | |
| MemArenaTemp | mem_arena_temp_begin (MemArena *arena) |
| Temporary Memory API. | |
| void | mem_arena_temp_end (MemArenaTemp temp) |
Restores the arena to the position saved in temp. | |
| static void * | mem_arena_alloc_impl (MemAllocMode mode, void *ctx, usize size, void *old_ptr) |
| Generic Allocator Interface Implementation. | |
| MemAllocator | mem_arena_allocator (MemArena *arena) |
| Wraps a MemArena in the generic MemAllocator interface. | |
Implementation of the Virtual Memory Linear (Arena) Allocator.
Definition in file mem_arena.c.
| #define MEM_ARENA_COMMIT_SIZE KB(64) |
Definition at line 13 of file mem_arena.c.
|
static |
Generic Allocator Interface Implementation.
Definition at line 149 of file mem_arena.c.


Definition at line 16 of file mem_arena.c.