0Pricing
Java Academy · Lesson

JVM Heap Regions and Object Lifecycle

Explore Young Generation (Eden, Survivor), Old Generation, and Metaspace and how objects move between them.

The JVM Memory Model

The JVM divides memory into several areas. The heap holds all class instances and arrays. Off-heap areas include Metaspace (class metadata), stack frames, and native memory.

Young Generation: Eden Space

Newly allocated objects go to Eden. When Eden fills up, a Minor GC runs. Surviving objects are copied to a Survivor space.

// Object allocation starts in Eden:
String s = new String("hello");  // allocated in Eden
List<Integer> list = new ArrayList<>();  // also Eden

All lessons in this course

  1. JVM Heap Regions and Object Lifecycle
  2. GC Algorithms: Serial, G1, ZGC, Shenandoah
  3. Detecting and Fixing Memory Leaks
  4. GC Tuning Flags and JVisualVM Profiling
← Back to Java Academy