Home Cheat Sheets JVM Memory Model Diagram
📋 CHEAT SHEET

JVM Memory Model Diagram

Visual diagram of JVM memory areas — Heap, Young/Old generation, Metaspace, Stack, PC Register and Code Cache explained.

Read Full Tutorial →
JVM Memory Architecture
Shared — all threads
Heap · GC managed
Heap
Objects and arrays · tuned via -Xms / -Xmx
Young generation · Minor GC (milliseconds)
Eden space
New objects
All allocations start here
Survivor S0
From space
Survived 1+ GC
Survivor S1
To space
Copy target
Old generation (tenured) · Major GC (seconds)
Long-lived objects · promoted after N GC cycles · -XX:MaxTenuringThreshold
G1GC · ZGC · Shenandoah
No GC · native memory
Metaspace
Class metadata
Class bytecodes · method info · constant pool · replaced PermGen in Java 8+
-XX:MaxMetaspaceSize
Per-thread — not shared
JVM stack
Stack frames
One frame per method · local vars · operand stack · return address
StackOverflowError
PC register
Program counter
Current bytecode instruction address
Native stack
JNI calls
C/C++ native method frames
JIT only · no GC
Code cache
JIT-compiled native code
Hotspot methods compiled to machine code · -XX:ReservedCodeCacheSize
More Cheat Sheets
Java Collections Cheat SheetJava Streams API Cheat SheetPython Built-in Functions Cheat SheetSQL Joins Cheat SheetDocker Commands Cheat SheetHow HashMap Works InternallyMicroservices Architecture DiagramPandas Cheat Sheet