Header size with -XX:-UseCompressedOops

Thomas Stüfe thomas.stuefe at gmail.com
Tue Apr 12 07:19:53 UTC 2022


On Mon, Apr 11, 2022 at 10:24 PM Ioi Lam <ioi.lam at oracle.com> wrote:

> I vaguely remember there were some pathological cases where the
> ClassSpace was fragmented so badly that we ran out of space for loading
> new classes, even though the total size of classes were well below 1GB.
>
> Thomas, after your clean-up of the metaspace allocation code, do we
> still have such these fragmentation problems?
>
>
In theory yes, but it's quite unlikely now since the new buddy allocator is
very effective in preventing fragmentation at chunk level.

Note that every allocator would have some internal fragmentation. Thats the
price we paid for moving Klass out of Permgen.

(still beats Permgen though :).

Cheers, Thomas


> Thanks
> - Ioi
>
> On 4/11/2022 11:15 AM, Stefan Reich wrote:
> > 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 ==
> >>>
>
>


More information about the hotspot-dev mailing list