Skip to content

Path 1 of 4

JVM Runtime and Memory

How a class becomes running machine code, where every kind of memory lives, how objects are allocated, and what the JIT compiler does with hot code.

0 / 4 lessons completed ยท about 108 min in total

After this path you can

Outcomes

  • Trace a class from the .class file to compiled machine code
  • Say which memory area a given OutOfMemoryError points at
  • Predict when an allocation never reaches the heap
  • Read what the JIT did to a hot method

Lessons

  1. 1JVM architecture, class loading and bytecode executionHow a .class file becomes running code: loading, linking, initialisation, the three class loaders, and how to diagnose missing classes, loader leaks and slow startup.Foundation26 min
  2. 2Heap, stacks, Metaspace and native memoryEvery memory area of a JVM process, which limit applies to each, which OutOfMemoryError points at which area, and why a container is killed while the heap looks fine.Intermediate28 min
  3. 3Object allocation, TLABs and escape analysisWhat `new` costs: allocation in a TLAB, object headers and layout, the path from eden to the old generation, when the JIT removes an allocation, and how to find allocation hot spots.Intermediate27 min
  4. 4JIT compilation, profiling and warm-upHow HotSpot moves a method from the interpreter through C1 to C2, what profiling and inlining buy, why code is deoptimised, and why the first requests after a deploy are slow.Advanced27 min

Simulations and labs for this path

A simulation in the browser, then the same failure on a real JVM.

  1. Simulation 4GC pressure: when the live set fills the heap
  2. Simulation 5Heap leak: the cache that never hits