Is there a younger and older generation in all JVM heaps?

for example, is the JVM, of the generation collection algorithm GC used to divide the young and the old,
or no matter which GC algorithm is used, the heap is divided into the young and the old?

Mar.23,2021
The

jvm standard has almost no specific requirements for GC


Java virtual machine specification does not give any definition of GC, nor does it classify the heap. Therefore, in theory, it is not certain whether to distinguish between the young and the old.


quote the words in "in-depth understanding of the Java virtual machine":
first of all, there is no provision in the Java virtual machine specification for how the garbage collector should be implemented.

current commercial virtual machine garbage collection uses "generational collection" (Generational Collection) algorithm, which has no new idea, but divides memory into several blocks according to the survival period of objects. Generally, the Java heap is divided into the new generation and the old age, so that the most appropriate collection algorithm can be adopted according to the characteristics of each age.

however, no matter how the partition, it has nothing to do with the storage content, no matter which area, the storage is still the object instance, the purpose of further partition is to better reclaim memory, or to allocate memory faster.

that is to say, generational collection is the best solution found so far to better reclaim memory or allocate memory faster.
several GC introduced in it are all based on generational collection (including G1). For several garbage collection algorithms introduced (tag-clear, copy, tag-collate), they will be more efficient under generational collection.

Menu