Demystifying JVM Memory Management
Source: https://foojay.io/today/demystifying-jvm-memory-management/
# JVM memory structure
# Heap
- This is where JVM store dynamic data.
- Biggest block of memory area and this is where GC takes place.
- The size of heap memory can be controlled in
Xms
(Initial) andXmx
(max) flags. - The entire heap memory is not committed to the
Virtual Machine (VM)
as some of it is reserved as virtual space and the heap can grow to use this. - Divided into “Young” and “Old” generation.
# Young generation
- Also called “New Space”, this is where new objects live and further divided into “Eden Place” and “Survivor Space”.
- Managed by “Minor GC” or “Young GC”.
- “Eden Space”: this is where new objects created. When we can create a new object, memory is allocated here.
- “Survivor Space”: This is where objects that survived the minor GC are stored, divided in two halves, S0 and S1.