Video in progress
How do you tell apart the terms Minor GC, Major GC and Full GC?
A Minor GC cleans only the young generation and is usually short. A Major GC deals with the old generation. A Full GC cleans the whole heap (often Metaspace too) and gives the longest pause.
📖 Answer
A minor (young) GC runs when Eden fills up. It happens often, but takes milliseconds. Lots of minor GCs is a normal situation.
The term "Major GC" is not official and is used differently across GCs. It usually means cleaning the old generation; in G1 the matching thing is a "mixed collection" (young + some of the old regions).
A Full GC is the whole heap, often stop-the-world and done in one go. In G1 a Full GC is an "emergency": a signal that the concurrent cleanup couldn't keep up.
How it looks in the log (Java 17, -Xlog:gc):
[gc] GC(12) Pause Young (Normal) (G1 Evacuation Pause) 412M->98M(1024M) 8.311ms
[gc] GC(40) Pause Full (Allocation Failure) 1010M->870M(1024M) 2.917s
The second line is worrying: the Full GC took 3 seconds and barely freed any memory. That points to a leak or an insufficient heap.
Sign up to mark studied questions and save your progress.