Mostly concurrent compaction for mark-sweep GC
Abstract
A memory manager that does not move objects may suffer from memory fragmentation. Compaction is an efficient, and sometimes inevitable, mechanism for reducing fragmentation. A Mark-Sweep garbage collector must occasionally execute a compaction, usually while the application is suspended. Compaction during pause time can have detrimental effects for interactive applications that require guarantees for maximal pause time. This work presents a method for reducing the pause time created by compaction at a negligible throughput hit. The solution is most suitable when added to a Mark-Sweep garbage collector. Compaction normally consists of two major activities: the moving of objects and the update of all the objects' references to the new locations. We present a method for executing the reference updates concurrently, thus eliminating a substantial portion of the pause time hit. To reduce the time for moving objects in each compaction, we use the existing technique of incremental compaction, but select the optimal area to compact. Selecting the area is done after executing the mark and sweep phases, and is based on their results. We implemented our compaction on top of the IBM J9 JVM V2.2, and present measurements of its effect on pause time, throughput, and mutator utilization. We show that our compaction is indeed an efficient fragmentation reduction tool, and that it improves the performance of a few of the benchmarks we used, with very little increase in the pause time (typically far below the cost of the mark phase). Copyright 2004 ACM.