diff options
| author | Laytan Laats <laytanlaats@hotmail.com> | 2023-12-18 15:17:27 +0100 |
|---|---|---|
| committer | Laytan Laats <laytanlaats@hotmail.com> | 2023-12-18 15:17:27 +0100 |
| commit | 4ae021cd4cc8fb8a1cf27c0b7c2272ddd025dde0 (patch) | |
| tree | c49f385861a39845b91048cb8e1675e4f3dc22ec /core/runtime | |
| parent | af962526df0f082083646d9ff8e13bff5bcbc921 (diff) | |
add other failing test and fix them
Diffstat (limited to 'core/runtime')
| -rw-r--r-- | core/runtime/default_allocators_arena.odin | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/runtime/default_allocators_arena.odin b/core/runtime/default_allocators_arena.odin index 1c36c4f7c..3e78e7f20 100644 --- a/core/runtime/default_allocators_arena.odin +++ b/core/runtime/default_allocators_arena.odin @@ -102,14 +102,14 @@ arena_alloc :: proc(arena: ^Arena, size, alignment: uint, loc := #caller_locatio if size == 0 { return } - - if arena.curr_block == nil || (safe_add(arena.curr_block.used, size) or_else 0) > arena.curr_block.capacity { - size = align_forward_uint(size, alignment) + + needed := align_forward_uint(size, alignment) + if arena.curr_block == nil || (safe_add(arena.curr_block.used, needed) or_else 0) > arena.curr_block.capacity { if arena.minimum_block_size == 0 { arena.minimum_block_size = DEFAULT_ARENA_GROWING_MINIMUM_BLOCK_SIZE } - block_size := max(size, arena.minimum_block_size) + block_size := max(needed, arena.minimum_block_size) if arena.backing_allocator.procedure == nil { arena.backing_allocator = default_allocator() |