Mark and split

The mark-sweep garbage collection algorithm constructs a list of memory areas to allocate into (the free list) during its sweep phase. This phase needs time proportional to the size of the heap which is collected. We introduce mark-split, a non-moving garbage collection algorithm that constructs the free list during the mark phase by maintaining and splitting free intervals. With mark-split, the sweep phase of mark-sweep becomes unnecessary and the cost of collection is proportional to the size of the live data set. Our performance evaluation, using a high performance Java implementation running standard benchmarks, shows that mark-split can significantly reduce collection times compared with mark-sweep and requires little extra space to do so. The overhead to the cost of marking is moderate and often pays off for itself by avoiding the sweep phase. Since there is no guarantee that this is always the case, we also propose adaptive schemes that try to combine the best performance characteristics of mark-split and mark-sweep collection.