Axa Assurance Maroc - Insurer Innovation Award 2024
Java JVM Memory Cheat Sheet
1. 1 H E A P S E G M E N T
L I V E E X A M P L E
Contains all created objects in runtime, objects only
plus their object attributes (instance variables)
= Young (new objects that die more often than old
ones)
- Eden
- Survivor 1
- Survivor 2
= Old (objects that outlived several Garbage
Collectors cycles)
2 S T A C K S E G M E N T ( O F F - H E A P )
Contains local variables and Reference variables
(variables that hold the address of an object in the
heap
= Stack (-Xss, max memory, it is around 2000
threads for average enterprise app. , 2000 x 1mb =
2GB )
= Metaspace (-XX:MetaspaceSize=256m)
= Code Cache(-XX:InitialCodeCacheSize 100 mb)
3 C O D E S E G M E N T ( O F F - H E A P )
The segment where the actual compiled Java
bytecodes resides when loaded
JAVA MEMORY
MODEL
CHEAT SHEET
T Y P E S I Z E S
MynameisMarkand
I'mJavaSenior
Consultantwith+10
yearsofexperience