MPS issue job003923

TitleClient arena fails to detect too-small size
Statusclosed
Priorityoptional
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionIf you try to create a client arena with a MPS_KEY_ARENA_SIZE that's too small for a full complement of zones, then mps_arena_create_k should return MPS_RES_MEMORY. But in fact you get an assertion failure:

./arena.c:157: MPS ASSERTION FAILED: ((Size)1 << arena->zoneShift) >= arena->grainSize
AnalysisThe code in arenacl.c [1] tests the condition:

    size < grainSize * MPS_WORD_SHIFT

but the correct condition is the one in arenavm.c [2]:

    size < grainSize * MPS_WORD_WIDTH

This was not discovered because the automated test for small arena sizes [3] only creates VM arenas.
How foundautomated_test
Evidence[1] <http://www.ravenbrook.com/project/mps/master/code/arenacl.c>
[2] <http://www.ravenbrook.com/project/mps/master/code/arenavm.c>
[3] <http://www.ravenbrook.com/project/mps/master/test/function/121.c>
Created byGareth Rees
Created on2015-08-10 11:36:10
Last modified byGareth Rees
Last modified on2016-03-13 00:29:18
History2015-08-10 GDR Created.

Fixes

Change Effect Date User Description
188144 closed 2015-08-14 10:57:06 Gareth Rees Merge branch/2015-08-10/arena-create into the master sources.