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