Tuesday, June 05, 2007

Compacting algorithms

algorithms result in a fragmented heap, because objects that are
garbage collected in the sweep phase, usually occupy arbitrary
positions in the heap, resulting in holes, wherever the old objects
were garbage collected. Compacting algorithms have a modified sweep
phase, in which all live objects are copied into one end of the heap.
After they are copied, the rest of the heap is freed. This places all
live objects contiguously, and the heap is defragmented.


  • The memory is defragmented in the sweep phase


  • The [Java] program has to be paused when the garbage collector starts.

  • References have to be updated when the live objects are moved.

Discuss this post in the learning forum.

Commercial Links

Note: This text was originally posted on my earlier blog at http://www.adaptivelearningonline.net

No comments: