Header size with -XX:-UseCompressedOops

Stefan Reich stefan.reich.maker.of.eye at googlemail.com
Mon Apr 11 16:57:36 UTC 2022


Hi, quick question to the experts.

Java object header size is 12 bytes with CompressedOOPS (have verified this
many times).

Now I did a test with -XX:-UseCompressedOops just for fun and found that
headers are still 12 bytes?

I verified this in two ways:

a. using Unsafe.objectFieldOffset
b. making a whole lot of identical objects and measuring heap use before
and after (with calls to System.gc)

Both these methods give me a size of 16 bytes for an object with a single
int field.

How is this possible?

Many greetings
Stefan Reich

-- 
== Gaz.AI ==


More information about the hotspot-dev mailing list