JavaAdvanced#memory#gc

What are the different generations in the JVM heap?

Young Generation (Eden + two Survivor spaces) holds newly created objects and is collected frequently with a Minor GC. Old Generation (Tenured) holds long-lived objects promoted from Young Gen, collected less often with a Major/Full GC. Metaspace stores class metadata (replacing PermGen since Java 8).

Example
// Object created -> Eden space
// Survives a few GC cycles -> moved to Survivor space
// Survives further -> promoted to Old Generation

Related Questions

1
JavaAdvanced#memory#gc

What causes a memory leak in Java despite having garbage collection?

Open
2
JavaAdvanced#memory#gc

What is the difference between strong, weak, soft, and phantom references?

Open
3
JavaAdvanced#gc#jvm

What is the difference between G1, CMS, and ZGC garbage collectors?

Open