What are the Different Types of GC ?

There are 3 types of garbage collection:

  1. Minor GC
  2. Major GC
  3. Full GC

Minor GC: It’s also called as Scavenge GC. This is the GC which collects garbage from the Young Generation.

Major GC: This GC collects garbage from the Old Generation

Full GC: This GC collects garbage from all regions i.e. Young, Old, Perm, Metaspace.

When Major or Full GC run all application threads are paused. It’s called a stop-the-world event. In Minor GCs, stop-the-world events occurs, but only momentarily.

CORE JAVA GARBAGE-COLLECTOR