JEP 450 : Compact Object Headers i
What is JEP 450?
In Java, every object has a header (used for synchronization, identity hashcode, GC, etc.)
Historically, it was 96 bits (12 bytes) on 64-bit platforms
With JEP 450, object headers are now optional and compact — down to 64 bits (8 bytes) when possible
Why does it matter?
More efficient object layout
Better cache locality
Up to 5–10% memory savings in some apps
DEMO
Try to see class layout - attempt 1 - org.openjdk.jol
First run :
to copy org.openjdk.jol to traget to have it on classpath later
then run :
now without Compact object headers
now try
If the same output
Try to see class layout - attempt 2 - mass allocation
with method :
We have two different results :
Education :
Last updated