JVM ავტომატურად მართავს მეხსიერებას — ობიექტებს გამოყოფს და მიუწვდომელი ობიექტებს ათავისუფლებს ნაგავის კრებას (GC)-ის საშუალებით — ასე რომ თქვენ არ უნდა ხელით გაათავისუფლოთ მეხსიერება. მეხსიერების რეგიონებისა და GC ქცევის გაგება მნიშვნელოვანია წრფიობის ოპტიმიზაციისა და მეხსიერების პრობლემების დიაგნოსტიკისთვის.
JVM მეხსიერების რეგიონები
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+)
