|Title||Assertion failure if you try to create a small arena|
|Assigned user||Gareth Rees|
|Description||MMQA test function/121  tries to create a virtual memory arena with initial size 65536. It fails with this assertion:|
arena.c:131: MPS ASSERTION FAILED: ((Size)1 << arena->zoneShift) >= arena->alignment
There are three problems with this:
1. There's no indication in the documentation that creating a small arena might fail.
2. Failing with an assertion rather than returning MPS_RES_PARAM is naughty.
3. Why does this have to fail anyway? It's a virtual memory arena that's capable of extending itself if need be, so why not just round up to minimum size?
(Originally reported by RIT .)
|Analysis||The minimum size of a virtual memory arena is pagesize * MPS_WORD_WIDTH -- on 64-bit OS X that's 4096 * 64 = 262144.|
ArenaCreate tries to return a result code (ResMEMORY though) but because it only detects the problem after it has called class->init (VMArenaInit in this case), it has to call class->finish (VMArenaFinish in this case), and the first thing that VMArenaFinish does is AVERT(Arena, arena) which calls ArenaCheck which asserts.
|Created by||Gareth Rees|
|Created on||2013-05-25 20:06:46|
|Last modified by||Gareth Rees|
|Last modified on||2014-10-08 22:16:56|
|History||2013-05-25 GDR Created.|
|187164||closed||2014-10-08 22:16:56||Gareth Rees||If you try to create a client arena that's too small for the full complement of zones, return MPS_RES_MEMORY instead of asserting.
If you try to create a virtual memory arena that's too small for the full complement of zones, round up the size to the minimum instead of asserting.