Fixed bug in mem_arena_alloc when selecting chunk from which to allocate
This commit is contained in:
parent
2fe683b79d
commit
d9a9215fa8
|
@ -75,12 +75,19 @@ void* mem_arena_alloc(mem_arena* arena, u64 size)
|
|||
|
||||
u64 nextOffset = chunk->offset + size;
|
||||
u64 lastCap = chunk->cap;
|
||||
while(chunk && nextOffset > chunk->cap)
|
||||
while(nextOffset > chunk->cap)
|
||||
{
|
||||
chunk = list_next_entry(&arena->chunks, chunk, mem_arena_chunk, listElt);
|
||||
if(chunk)
|
||||
{
|
||||
nextOffset = chunk->offset + size;
|
||||
lastCap = chunk->cap;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!chunk)
|
||||
{
|
||||
u64 reserveSize = maximum(lastCap * 1.5, size);
|
||||
|
|
Loading…
Reference in New Issue