Guide
What is the difference between the JVM specification and HotSpot?
What the Java Virtual Machine Specification requires and what HotSpot, the JVM in OpenJDK, chooses: the method area and Metaspace, the heap and its generations, the interpreter and the JIT.
Two names to keep apart
- JVM
The engine that runs Java bytecode on a real computer, managing memory and turning bytecode into machine work.
JVM in the glossaryAn abstract machine defined by the Java Virtual Machine Specification: the class file format, instruction set, loading/linking/initialization rules and run-time data areas. Concrete implementations such as or Eclipse OpenJ9 realize it with their own memory layouts, garbage collectors and compilers.
- HotSpot
The JVM that ships with OpenJDK and most Java downloads. Its name comes from finding the "hot spots" of a program and compiling them.
HotSpot in the glossaryOpenJDK's JVM implementation, written mostly in C++ (
libjvm). It provides a template interpreter, the C1 and C2 JIT compilers with tiered compilation, several garbage collectors (Serial, Parallel, G1, ZGC, Shenandoah, Epsilon), Metaspace, class data sharing and extensive diagnostics. Everything dashed in this atlas is a HotSpot (JDK 25) structure.
Part by part: what is required, what HotSpot chooses
Method area
JVM specificationThe specification requires
A logical shared area for per-class structures; location and management not mandated.
HotSpot (JDK 25) does
HotSpot JDK 25: Metaspace (native memory) for metadata; compressed class space (1 GB by default) for Klass structures; Class mirrors and static fields in the heap.
Heap
JVM specificationThe specification requires
One shared heap, automatically managed, no layout or algorithm mandated (JVMS §2.7: "does not mandate any particular internal structure for objects").
HotSpot (JDK 25) does
HotSpot JDK 25: GC-specific layout (G1 regions by default), TLAB allocation, 12-byte headers and compressed oops by default.
Interpreter
JVM specificationThe specification requires
Conceptual fetch-decode-execute loop over JVM instructions.
HotSpot (JDK 25) does
HotSpot: template interpreter generated at start-up, with register-cached state and profiling.
JIT compiler
HotSpot · JDK 25HotSpot uses tiered compilation (compilationPolicy.hpp): level 0 interpreter; 1 C1 without profiling; 2 C1 with invocation and back-edge counters; 3 C1 with full profiling; 4 C2. The common path is 0 → 3 → 4; trivial methods go to level 1; when the C2 queue is long, methods may take 0 → 2 → 3 → 4. Transitions are governed by thresholds such as Tier3InvocationThreshold (200) and Tier4InvocationThreshold (5000), scaled by compiler-queue load. Compilation runs in background compiler threads (3 in our measured run on 4 CPUs) while the application keeps executing.
OpenJDK 25 builds ship C1 and C2; GraalVM distributions can plug in the Graal compiler instead through JVMCI.
Garbage collector
JVM specificationThe specification requires
Automatic reclamation is required; the technique, timing and pauses are not specified.
HotSpot (JDK 25) does
HotSpot JDK 25: Serial, Parallel, G1 (default), ZGC, Shenandoah, Epsilon.
Class loader subsystem
JVM specificationJVMS Chapter 5 defines three steps. creates a class from a binary representation using a class loader. combines the class into the run-time state: , and, possibly later, . executes the class initialization method <clinit>.
A run-time class is identified by its binary name and its defining class loader, so the same bytes loaded by two loaders produce two distinct classes. HotSpot records loaded classes per loader (ClassLoaderData, SystemDictionary) and stores their metadata in Metaspace.
Metaspace
- Metaspace
HotSpot's memory for class information. It lives outside the Java heap.
Metaspace in the glossaryNative memory where HotSpot allocates class metadata (
InstanceKlass,Method,ConstMethod,ConstantPool, …), per class loader. It replaced the PermGen in JDK 8 (JEP 122), grows on demand (MaxMetaspaceSizeis unlimited by default) and is released when loaders are unloaded.