Java Core & JVM (50 Qs)•Part 3: JVM Internals, Low-Latency Systems & Production Tuning (25 - 35)
JVM Memory Architecture: Heap, Metaspace, and Stack.
senior LevelMemory ManagementSystem DesignData Structures
In Simple Words:
- JVM Stack: Thread-private. Stores stack frames containing primitive local variables, method call parameters, and object references.
- Heap Memory: Shared across all threads. Stores all class instances and arrays.
- Young Generation (Eden + Survivor S0/S1): Where new objects are allocated.
- Old (Tenured) Generation: Stores long-lived surviving objects.
- Metaspace: Stores class metadata, bytecode, and method tables in native off-heap memory (replaces PermGen since Java 8).