diff options
| author | alektron <alektron1@gmail.com> | 2025-01-15 17:59:30 +0100 |
|---|---|---|
| committer | alektron <alektron1@gmail.com> | 2025-01-15 17:59:30 +0100 |
| commit | a0c20023fc87e0cbd2a2316a2eb993edf67815cf (patch) | |
| tree | 35d9e0646d87504c1908651b72c23657c6b503ef /base/runtime | |
| parent | 432c49e214ae2c4c7352302b07541ad2bf9e3fce (diff) | |
Fix: Issue with non-zeroed memory after arena_temp_and;
Fix: total_used field of growing Arena was not decremented correctly in arena_temp_end;
Diffstat (limited to 'base/runtime')
| -rw-r--r-- | base/runtime/default_temp_allocator_arena.odin | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/base/runtime/default_temp_allocator_arena.odin b/base/runtime/default_temp_allocator_arena.odin index db157b267..878a2d070 100644 --- a/base/runtime/default_temp_allocator_arena.odin +++ b/base/runtime/default_temp_allocator_arena.odin @@ -282,9 +282,10 @@ arena_temp_end :: proc(temp: Arena_Temp, loc := #caller_location) { if block := arena.curr_block; block != nil { assert(block.used >= temp.used, "out of order use of arena_temp_end", loc) - amount_to_zero := min(block.used-temp.used, block.capacity-block.used) + amount_to_zero := block.used-temp.used intrinsics.mem_zero(block.base[temp.used:], amount_to_zero) block.used = temp.used + arena.total_used -= amount_to_zero } } |