mmtk-core
mmtk-core copied to clipboard
Assert reserved pages during GC to check over-allocating caused by copying
Copy allocators can allocate without checking the heap size, and the copy allocation will only fail if the physical allocation fails. We simply rely on 'collection_reserve' to make sure we leave enough room for copying when a GC is triggered, and rely on the policies to copy no more than than what they claim to copy. If anything goes wrong, we may end up over allocating above the heap size. It would be good if we put an assertion to make sure that we always stay below the heap size during copying.
Note that when calculating collection reserve, we do not take object size growth into consideration. So the copied objects are larger, we may see the heap size larger than specified size.