Compact object headers
Cut object header size in half for better memory density and cache usage.
Code Comparison
✕ Java 8
// Default: 128-bit object header // = 16 bytes overhead per object // A boolean field object = 32 bytes! // Mark word (64) + Klass pointer (64)
✓ Java 25
// -XX:+UseCompactObjectHeaders // 64-bit object header // = 8 bytes overhead per object // 50% less header memory // More objects fit in cache
Why the modern way wins
50% smaller headers
8 bytes instead of 16 per object.
Better cache usage
More objects fit in CPU cache lines.
Higher density
Fit more objects in the same heap size.
Old Approach
128-bit Headers
Modern Approach
64-bit Headers
Since JDK
25
Difficulty
advanced
JDK Support
Compact object headers
Available
Finalized in JDK 25 LTS (JEP 519, Sept 2025).
How it works
Compact object headers reduce the per-object overhead from 128 bits to 64 bits on 64-bit platforms. This saves memory and improves cache utilization, especially for applications with many small objects.