Commit 1183ae94 authored by Daniel Gröber (dxld)'s avatar Daniel Gröber (dxld) Committed by Marge Bot

rts: Fix Arena blocks accounting for MBlock sized allocations

When requesting more than BLOCKS_PER_MBLOCK blocks allocGroup can return a
different number of blocks than requested. Here we use the number of
requested blocks, however arenaFree will subtract the actual number of
blocks we got from arena_blocks (possibly) resulting in a negative value
and triggering ASSERT(arena_blocks >= 0).
parent b3857b62
......@@ -82,7 +82,7 @@ arenaAlloc( Arena *arena, size_t size )
// allocate a fresh block...
req_blocks = (W_)BLOCK_ROUND_UP(size) / BLOCK_SIZE;
bd = allocGroup_lock(req_blocks);
arena_blocks += req_blocks;
arena_blocks += bd->blocks;
bd->gen_no = 0;
bd->gen = NULL;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment