mirror of
https://github.com/odin-lang/Odin.git
synced 2026-05-28 06:35:11 +00:00
Merge pull request #6552 from alektron/virtual_arena_overcommit_bug_revisited
Fix arena overcommit bug (revisited)
This commit is contained in:
@@ -141,9 +141,9 @@ arena_alloc_unguarded :: proc(arena: ^Arena, size: uint, alignment: uint, loc :=
|
||||
|
||||
needed := mem.align_forward_uint(size, alignment)
|
||||
needed = max(needed, arena.default_commit_size)
|
||||
block_size := max(needed, arena.minimum_block_size) + alignment
|
||||
block_size := max(needed, arena.minimum_block_size)
|
||||
|
||||
new_block := memory_block_alloc(needed, block_size) or_return
|
||||
new_block := memory_block_alloc(needed, block_size, alignment) or_return
|
||||
new_block.prev = arena.curr_block
|
||||
arena.curr_block = new_block
|
||||
arena.total_reserved += new_block.reserved
|
||||
|
||||
@@ -115,7 +115,7 @@ memory_block_alloc :: proc(committed, reserved: uint, alignment: uint = 0, flags
|
||||
}
|
||||
|
||||
pmblock.block.committed = committed
|
||||
pmblock.block.reserved = reserved
|
||||
pmblock.block.reserved = total_size - uint(base_offset)
|
||||
|
||||
|
||||
return &pmblock.block, nil
|
||||
|
||||
Reference in New Issue
Block a user