Mark and sweep is the basic operation of reclaiming memory, and it is done in two stages:
All objects that are alive in the generation being garbage collected and in younger generations are marked as alive. (Alive means pointed to by some other live object.)
All unmarked objects in the generations being garbage collected are added to the free blocks, and all marked objects are unmarked.
A mark and sweep operation is always on all the generations from 0 to a specific number.
A mark and sweep operation can be caused explicitly by calling
Promotion is the process of moving objects from one generation to the next generation. An object is marked for promotion after surviving a specific number of mark and sweep operations, but may be promoted before that. The number of survivals is specific to each segment.
Promotion does not free objects.