4 min read
JVM Internals Overview
Prerequisites: Memory management & garbage collection
A few pieces of the JVM worth knowing exist, without needing to master them immediately:
- Classloading — the JVM loads
.classfiles on demand, the first time a class is actually referenced. - The JIT compiler — bytecode starts out interpreted, but code paths run repeatedly are compiled down to native machine code at runtime for speed (this is why a long-running JVM process often gets faster the longer it runs).
- The heap and garbage collector — several GC algorithms exist (G1, the default in modern JVMs, among others), tuned via JVM flags for different workloads.
java -Xmx512m -XX:+UseG1GC Main # example JVM tuning flags