Some comments

This commit is contained in:
Nils O. Selåsdal
2026-06-09 10:41:51 +02:00
parent 3de3206706
commit a092599a1a
4 changed files with 23 additions and 18 deletions
+7 -9
View File
@@ -14,18 +14,19 @@ struct ArenaParams {
typedef struct MemoryBlock MemoryBlock;
struct MemoryBlock {
U8 *base;
U32 size;
U32 pos; // start of next allocation
U32 base_pos; // absolute position of base relative to the first linked arena
U32 committed_pos;
U32 size; // Block size, page aligned
U32 pos; // start of next allocation
U32 base_pos; // absolute position of base relative to the first linked arena
U32 committed_pos; // end of committed region. Will be page aligned
MemoryBlock *prev;
};
typedef struct Arena Arena;
struct Arena {
MemoryBlock *current;
U32 block_size;
U32 commit_size;
U32 block_size; // requested block size
U32 commit_size; // requested commit size
U32 page_size; // cached page size
ArenaFlags flags;
S32 checkpoint_level;
};
@@ -39,10 +40,7 @@ struct ArenaCheckPoint {
StaticAssert(sizeof(MemoryBlock) <= 64);
#define MemoryBlock_Header_Size 64u
void arena_init(Arena *arena, const ArenaParams *params);
void arena_free(Arena *arena);
void *arena_push(Arena *arena, U32 size, U32 align);