Description
Currently we have a MallocSpace
policy which uses the library malloc as the freelist allocator and does mark/sweep. As we will have our own free list allocator (#348), we should refactor the existing MallocSpace
to extract the common mark sweep code for a MarkSweepSpace
while separating the code for the global part of the free list allocator.
What we have now for the marksweep plan is MallocAllocator + MallocSpace
.
For this refactoring, we should have: MallocAllocator + MarkSweepSpace<MallocAllocator>
. The marksweep space should replace the current MallocSpace
with a clear interface between the global freelist allocator and the policy. We may later have another plan MiMallocAllocator + MarkSweepSpace<MiMallocAllocator>
.
We need to be careful about the freelist allocator. For a library malloc, the address may be outside of our normal heap range, while for our 'native' freelist allocator, the address is always in our heap range. For sweeping, a library allocator can only do eager sweeping. But for our 'native' allocator, we should support both eager and lazy sweeping.