Header size with -XX:-UseCompressedOops

Stefan Reich stefan.reich.maker.of.eye at googlemail.com
Mon Apr 11 18:15:44 UTC 2022


So with CompressedOOPS=false and CompressedClassPointers=true, classes will
be put in a special segment that allows their pointers to be compressed?

Kinda makes sense because which program has more than a gigabyte worth of
actual class objects?

On Mon, 11 Apr 2022 at 20:11, Thomas Stüfe <thomas.stuefe at gmail.com> wrote:

> Hi Stefan,
>
> See
> https://bugs.openjdk.java.net/browse/JDK-8241825
>
> Cheers, Thomas
>
> On Mon 11. Apr 2022 at 19:58, Stefan Reich <
> stefan.reich.maker.of.eye at googlemail.com> wrote:
>
>> Hi Thomas,
>>
>> oh! Never heard about that change. Now I know. And yes this changes the
>> picture as expected.
>>
>> Thanks
>>
>> On Mon, 11 Apr 2022 at 19:28, Thomas Stüfe <thomas.stuefe at gmail.com>
>> wrote:
>>
>>> 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 ==
>>>>
>>>
>>
>> --
>> == Gaz.AI ==
>>
>

-- 
== Gaz.AI ==


More information about the hotspot-dev mailing list