Compact object headers
Cut object header size in half for better memory density and cache usage.
Porównanie kodu
✕ 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
Widzisz problem z tym kodem? Daj nam znać.
Dlaczego nowoczesne podejście wygrywa
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.
Stare podejście
128-bit Headers
Nowoczesne podejście
64-bit Headers
Od JDK
25
Poziom trudności
Zaawansowany
Wsparcie JDK
Compact object headers
Dostępne
Finalized in JDK 25 LTS (JEP 519, Sept 2025).
Jak to działa
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.
Powiązana dokumentacja