MPS issue job003789

TitleMPS does not try collecting when out of memory
Statusopen
Prioritynice
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionMMQA test function/130.c [1] carries out the following steps:
1. Set the commit limit.
2. Allocate live objects until the commit limit is reached.
3. Destroy all roots (so that all objects are now dead).
4. Allocate more objects.
It fails at step (4) with COMMIT_LIMIT. This despite the fact that all objects are dead, and so a garbage collection will be able to reclaim enough space to satisfy the request.
AnalysisThe sequence of calls that fail to allocate memory is mps_reserve → mps_ap_fill → BufferFill → AMCBufferFill → ChainAlloc → SegAlloc → ArenaAlloc → arenaAllocPolicy. Now, arenaAllocPolicy has five ways to try to get memory to satisfy the request, but collecting garbage is not one of them.

Note that although in this case arenaAllocPolicy could try starting or progressing a collection, in general that's not possible, because ArenaAlloc can also be called by the collector (for example, to allocate a nailboard, or a forwarding buffer for copied objects) and the MPS must not recurse [2].
How foundautomated_test
Evidence[1] http://www.ravenbrook.com/project/mps/master/test/function/130.c
[2] http://www.ravenbrook.com/project/mps/...ml#design.mps.sp.sol.depth.no-recursion
Test procedurefunction/130.c
Created byGareth Rees
Created on2014-05-12 17:04:25
Last modified byGareth Rees
Last modified on2014-10-24 12:45:30
History2014-05-12 GDR Created.
2014-10-24 GDR More analysis; downgraded to nice since it's not affecting anyone.