This article introduces the various GCS in the JVM to clarify the concepts.
You might see a lot of GC nouns, such as Minor, Young, Full, Old, Major, Mixed GC.
So many concepts, think of a headache, in the end all sorts of messy GC refers to what?
The following is a quote from R University’s answer on Zhihu:
In the implementation of HotSpot VM, there are actually two types of GC exactly:
- Partial GC: Mode that does not collect the entire GC heap
- Young GC: Collect only Young Gen’s GC. Young GC is also referred to as Minor GC
- Old GC: Only Old Gen GCS are collected. Only concurrent collections from garbage collector CMS are in this mode
- Mixed GC: Collects the entire Young Gen and part of the Old Gen GC, only garbage collector G1 has this mode
- Full GC: Collects all parts of the heap, including the new generation, old generation, and permanent generation (in JDK 1.8 and later, permanent generation was removed and replaced with metaspace metspace)
Let’s take a look at each GC again:
(1) Minor GC/Young GC
Let’s take a look at the Minor GC/Young GC. As you know, Young Gen can also be called the Young generation, and the terms are equivalent. Then, after the Eden memory area in the young generation is occupied, the GC of the young generation, or the new generation, actually needs to be triggered.
In this case, the Minor GC is also called a Young GC.
(2) Old GC
The Old GC is more appropriately called the Old GC, because it is literally called the Old GC.
However, the reason why we call the old GC Full GC is actually ok, but it is a different way of saying it literally.
To more accurately describe the meaning of the Old GC, we can call the Old GC Old GC.
(3) Full GC
Full GC refers to garbage collection of all memory space for the new generation, the old generation, and the permanent generation.
A Full garbage collection is performed on the JVM, collecting garbage from all memory regions.
(4) Major GC
There is also a term called Major GC, which is rarely used and is a very confusing concept.
Some people equate the Major GC to the Old GC, and some people equate the Major GC to the Full GC, and consider it to be the GC for the entire memory region of the JVM.
Therefore, in view of this easily confused concept, I suggest you to mention less in the future. If you hear someone talking about the concept of Major GC, you can ask him if he means Old GC. Or Full GC?
(5) Mixed GC
Mixed GC is peculiar to the G1 concept, in fact, to put it bluntly, once the main means in G1, s old occupy 45% of the heap memory (- XX: InitiatingHeapOccupancyPercent: Sets the Java heap usage threshold for trigger marking cycles. The default value is 45%. In this case, the Java heap ratio refers to nonyoungcapacity_bytes, including old + humongous), and the Mixed GC will be collected for both young and old generations. Mixed GC is only available in G1.
reference
https://tech.meituan.com/2016/09/23/g1.html
https://www.zhihu.com/question/41922036/answer/93079526
Understanding the Java Virtual Machine in Depth: Advanced JVM Features and Best Practices (version 3)