Skip to main content

JVM Internals

The JVM is the runtime that executes all bytecode — managing memory automatically, compiling hot code to native instructions via JIT, and loading classes on demand. Understanding JVM internals helps you diagnose OutOfMemoryError, tune GC pauses, and reason about performance at a level most developers never reach. It also answers interview questions that separate senior from junior engineers.

What You'll Find Here

NoteDescription
JVM Memory ModelHeap regions (Eden, Survivor, Old gen), stack frames, Metaspace, per-thread vs. shared areas.
Garbage CollectionGC roots, reachability, Minor/Major/Full GC, Serial/Parallel/G1/ZGC algorithms, tuning flags.
Class LoadingBootstrap → Platform → Application classloaders; parent-delegation model; loading, linking, initialization phases.
JIT CompilationInterpreter → C1 → C2 tiered compilation; inlining, escape analysis, deoptimisation.
Bytecode & .class Files.class file structure, constant pool, javap disassembler, generics erasure, lambdas via invokedynamic.

Learning Path

  1. JVM Memory Model — understand heap regions and where objects live before studying GC.
  2. Garbage Collection — GC roots, minor vs. major GC, and G1 as the default since Java 9.
  3. Class Loading — the parent-delegation model; custom classloaders for hot reload and isolation.
  4. JIT Compilation — tiered compilation explains "warmup" behavior in benchmarks and production services.
  5. Bytecodejavap is a practical tool; reading bytecode demystifies generics, lambdas, and string + concatenation.