-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
The CopyingCollector (which is mis-leadingly name) actually performs a mark-sweep-compact collection. The compaction phase of this policy contains a design flaw. The phase works as follows:
- free entire heap
- traverse live object tree (starting at roots)
- allocate each live object
This phase is flawed for several reasons:
- object traversal is not necessarily in heap-order
- by reallocating objects, we could possibly overwrite a live-object that has yet to be visited, corrupting it.
- in order for this compaction phase to work, objects would need to be traversed in the order that they appear in the heap; this guarantees that live objects will not be corrupted.
RealAllocatorperforms next fit allocation; it caches the last successfully allocated address, and starts subsequent free space searches from there. This adds a further twist into the compaction phase because we are not guaranteed to be starting from the beginning of the heap.- we would either need to reset this cached next-fit address, or make our compaction algorithm smart enough to start traversal from that address instead of the beginning of the heap.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels