When the young generation fills up, a young generation of just that generation is performed. When the old or permanent generation fills up, what is known as a full collection is typically done. That is, all generations are collected. Commonly, the young generation is collected first, using the collection algorithm designed specifically for that generation, because it is usually the most efficient algorithm for identifying garbage in the young generation. Then what is referred to below as the old generation collection algorithm for a given collector is run on both the old and permanent generation. If compaction occurs, each generation is compacted separately.
Sometimes the old generation is too full to accept all the objects that would be likely to be promoted from the young generation to the old generation if the young generation was collected first. In that case, for all but the CMS collector, the young generation collection algorithm is not run. Instead, the old generation collection algorithm is used on the entire heap.
The CMS old generation algorithm is a special case because it cannot collect the young generation.
//full GC 一般收集算法会对整个堆进行old generation collection algorithm, 但是CMS的old generation algorithm 不能对年轻代使用，因为不能收集年轻代空间