diff --git a/src/util.h b/src/util.h index 205e572..9581f9b 100644 --- a/src/util.h +++ b/src/util.h @@ -25,6 +25,7 @@ u64 utilFNV64a_str(const char* str, u64 hval = FNV1_64_INIT); struct MemoryArena { size_t max_size; + size_t free_size; void* head; void* next_free; }; @@ -117,6 +118,7 @@ arenaAllocateBlock(MemoryArena* arena, size_t block_size) assert(block_size > 0); void* ret = arena->next_free; arena->next_free = (uint8_t*) arena->next_free + block_size; + arena->free_size = arenaGetFreeSize(arena); return ret; }