From 1183ae94a256b30bfe12ddc5e1c29d6f46abd79d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Fri, 7 Feb 2020 07:22:23 +0100 Subject: [PATCH] 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). --- rts/Arena.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/Arena.c b/rts/Arena.c index a4ff11be7d..1d6dac623c 100644 --- a/rts/Arena.c +++ b/rts/Arena.c @@ -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; -- GitLab