JVM automatiškai valdo atmintį — paskirstydama objektus ir atlaisydama nepasiekiamus atliekų rinkimo (GC) būdu — todėl jums nereikia rankiniu būdu atlaisvinti atminties. Atmintis sričių ir GC elgsenos supratimas yra būtinas našumui reguliuoti ir atmintiesprobleмoms diagnozuoti.
JVM atmintisregionai
text
HEAP — where all OBJECTS live (shared across threads), GC operates here
├── Young Generation — new objects (most die young)
│ ├── Eden — new allocations go here
│ └── Survivor — objects that survived a young GC
└── Old (Tenured) Gen — long-lived objects (promoted from young)
STACK — per-thread; method frames, local variables, primitive locals, references
Metaspace — class metadata (replaced PermGen in Java 8+)
