Header size with -XX:-UseCompressedOops

Thomas Stüfe thomas.stuefe at gmail.com
Mon Apr 11 17:28:07 UTC 2022


Hi Stefan,

I think you want to set CompressedClassPointers.

There used to be a dependency between CompressedOops and
CompressedClassPointers - switching the former off switched the latter off
too - but that dependency is gone and these settings are now independent of
each other.

Cheers, Thomas

On Mon, Apr 11, 2022 at 6:57 PM Stefan Reich <
stefan.reich.maker.of.eye at googlemail.com> wrote:

> 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