Skip to content

CopyingCollector needs to be re-thought. #9

@aarontabor

Description

@aarontabor

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.
  • RealAllocator performs 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions