diff options
| author | alektron <alektron1@gmail.com> | 2025-03-02 17:46:39 +0100 |
|---|---|---|
| committer | alektron <alektron1@gmail.com> | 2025-03-02 17:46:39 +0100 |
| commit | fd539b5e81232d22ca40111b5dde07c76b0cb18c (patch) | |
| tree | d79f327351964d181608d6521c80006532be18e3 | |
| parent | b9b27bc1e031d26496656eb8f16b7a213d1cbf14 (diff) | |
Fix: When resizing a virtual arena by commiting more of the already reserved memory, the total_used field of the arena was not updated;
| -rw-r--r-- | core/mem/virtual/arena.odin | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/core/mem/virtual/arena.odin b/core/mem/virtual/arena.odin index 5191505cf..42f0054c2 100644 --- a/core/mem/virtual/arena.odin +++ b/core/mem/virtual/arena.odin @@ -341,7 +341,9 @@ arena_allocator_proc :: proc(allocator_data: rawptr, mode: mem.Allocator_Mode, new_end := start + size if start < old_end && old_end == block.used && new_end <= block.reserved { // grow data in-place, adjusting next allocation + prev_used := block.used _ = alloc_from_memory_block(block, new_end - old_end, 1, default_commit_size=arena.default_commit_size) or_return + arena.total_used += block.used - prev_used data = block.base[start:new_end] return } |