Java objects in memory include data and an Object Header, which contains the Mark Word and Class Word. These store essential information like the object's identity hash code, age, lock state, and reference to its class. Compressed OOPs allow addressing 32 GB of memory using 32-bit pointers by leveraging object alignment in memory. This trade-off between performance and memory space is enabled by default but can be disabled with a VM option. Future enhancements aim to further reduce object header size.

5m read timeFrom happycoders.eu
Post cover image
Table of contents
Structure of the Java Object HeaderMark WordClass WordJava Versions PDF Cheat Sheet (updated to Java 23)Stay up-to-date with the latest Java features with this PDF Cheat SheetCompressed OOPsOutlook: Compact Object Headers

Sort: