Difference Between Minor GC and Major GC in Java
Java uses Generational Garbage Collection where heap memory is divided into different areas. Based on which area is cleaned, Garbage Collection is classified as Minor GC and Major GC . 🔹 Minor GC (Young Generation GC) Minor GC occurs when the Young Generation memory becomes full. 👉 Newly created objects are stored here, and most objects die quickly. Characteristics Cleans Young Generation (Eden + Survivor spaces) Happens frequently Fast execution Short pause time Promotes long-living objects to Old Generation 🔹 Major GC (Old Generation GC) Major GC occurs when the Old Generation memory becomes full. 👉 This area contains long-lived objects. Characteristics Cleans Old (Tenured) Generation Happens less frequently Slower than Minor GC Longer application pause time More CPU usage 🔹 Key Differences 🔹 Simple Flow Objects created → Young Generation Minor GC runs → removes unused objects Surviving objects → moved to Old Generation Old Generation fills → Major GC runs ✅ Promotional C...