From 1086d1d350e4925b63e279d24d2c42654105efb4 Mon Sep 17 00:00:00 2001 From: Nikita Smith Date: Thu, 13 Aug 2026 13:39:00 -0700 Subject: [PATCH] reduce arena footprint by using initial reserve and commit size parameters `current` points to the most recently allocated arena. If that arena was allocated by a large push, lets say 2 GiB, while the arena's initial reserve size was 1 GiB, the next block would be allocated with a 2 GiB reserve. --- src/base/base_arena.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/base/base_arena.c b/src/base/base_arena.c index 2e9b3e00..d4376c10 100644 --- a/src/base/base_arena.c +++ b/src/base/base_arena.c @@ -227,8 +227,8 @@ arena_push(Arena *arena, U64 size, U64 align, B32 zero) if(new_block == 0) { - U64 res_size = current->res_size; - U64 cmt_size = current->cmt_size; + U64 res_size = arena->res_size; + U64 cmt_size = arena->cmt_size; if(size + ARENA_HEADER_SIZE > res_size) { res_size = AlignPow2(size + ARENA_HEADER_SIZE, align); @@ -236,9 +236,9 @@ arena_push(Arena *arena, U64 size, U64 align, B32 zero) } new_block = arena_alloc(.reserve_size = res_size, .commit_size = cmt_size, - .flags = current->flags, - .allocation_site_file = current->allocation_site_file, - .allocation_site_line = current->allocation_site_line); + .flags = arena->flags, + .allocation_site_file = arena->allocation_site_file, + .allocation_site_line = arena->allocation_site_line); size_to_zero = 0; }