Metaspace "capacity" reporting

Thomas Stüfe thomas.stuefe at gmail.com
Tue Feb 27 08:32:13 UTC 2018


Hi all,

I am looking into cleaning up metaspace.cpp a tiny bit (the logging and
reporting part), see https://bugs.openjdk.java.net/browse/JDK-8185034.

While examining the various flavors of MetaspaceAux::print_on(), I notice
that we often include "metaspace capacity" in our reports.

I wonder what the point of this number is. I can see "used", "committed"
and "reserved" being useful. "capacity" however is the sum of space
allocated to class loaders in the form of chunks. It includes both the used
portion of the chunks and the unused portion. The latter includes both
waste (unused in not-current chunks) and "free" (kinda) - unused in the
current chunk.

IMHO both "free" (unused space in the current chunk) and "capacity" (all
space assigned to a class loader) are only useful when looking at a single
class loader. But as a sum over all class loaders?

It cannot be used to gauge how much space we currently take from the
system, because it does not include neither free chunks (in freelist) nor
the committed-but-not-yet-handed-out portion of memory. For that,
"committed" is more useful.

It cannot be used to estimate when the next metaspace-induced GC will
happen.

Can someone enlighten me please? Can we maybe remove
MetaspaceAux::xxx_capacity() completely?

Thanks!

Thomas


More information about the hotspot-dev mailing list