Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CopyingCollector needs to be re-thought. #9

Open
aarontabor opened this issue Aug 20, 2015 · 6 comments
Open

CopyingCollector needs to be re-thought. #9

aarontabor opened this issue Aug 20, 2015 · 6 comments
Assignees

Comments

@aarontabor
Copy link
Contributor

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.
@aarontabor
Copy link
Contributor Author

The MarkSweepCollector needs to be rethought for the same reasons.

@aarontabor
Copy link
Contributor Author

This problem dates back (at least) as far as the point when we transitioned to Tracefile 3.0 format. f9d2771

@aarontabor aarontabor reopened this Aug 20, 2015
@aarontabor aarontabor self-assigned this Aug 26, 2015
@aarontabor
Copy link
Contributor Author

On the branch aarontabor-heaporder, I've pushed a new method: ObjectContainer::getLiveObjectsInHeapOrder(). This method will be needed to fix the compaction phases of collections.

@aarontabor
Copy link
Contributor Author

I performed a series of refactors to the Allocator and RealAllocator classes in order to better understand what is going wrong with these collection policies. The refactors have been pushed to the develop branch.

@aarontabor
Copy link
Contributor Author

There is a tentative fix for the mark sweep collector on aarontabor-markSweepFix.

When I perform a non-compacting mark-sweep (by commenting out the compact() call), if the heap size is not sufficient, the simulation enters an infinite loop. This is because the memory manager is attempting to shift() until a promotion occurs. To make the simulator report an "Out of Memory" error instead of entering this infinite loop, I had to set SHIFTING to 0 in defines.hpp.

@aarontabor
Copy link
Contributor Author

I took a closer look at the CopyingCollector as well. Please see issue #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant