RFR(XS) 8191924: Adjust DelegatingClassLoader's metadata space sizing algorithm

Thomas Stüfe thomas.stuefe at gmail.com
Tue Mar 13 17:46:43 UTC 2018


Hi Zhengyu,

On Tue, Mar 13, 2018 at 6:22 PM, Zhengyu Gu <zgu at redhat.com> wrote:

> Please review this simple patch, that applies the same sizing algorithm
> for anonymous class loader [1] to delegating class loader.
>
> Delegating class loader has similar memory usage pattern as anonymous
> class loader. By applying the same sizing logic, it reduces about the same
> percentage of wasted memory as anonymous class loader's metedata space.
>
> Ex.
>
> Before:
> ClassLoader: jdk/internal/reflect/DelegatingClassLoader
>   Metadata   capacity=      5.00KB used=      1.55KB free=      3.45KB
> waste=      0.04KB
>   Class data capacity=      1.00KB used=      0.58KB free=      0.42KB
> waste=      0.00KB
>
> After:
> ClassLoader: jdk/internal/reflect/DelegatingClassLoader
>   Metadata   capacity=      2.00KB used=      1.55KB free=      0.45KB
> waste=      0.04KB
>   Class data capacity=      1.00KB used=      0.58KB free=      0.42KB
> waste=      0.00KB
>
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8191924
> Webrev: http://cr.openjdk.java.net/~zgu/8191924/webrev.00/
>
> Test:
>
>   hotspot_runtime on Linux x64 (fastdebug and release)
>
>
> [1]https://bugs.openjdk.java.net/browse/JDK-8190729
>
> Thanks,
>
> -Zhengyu
>
>
Looks fine. Good results :)

Should we assert the Metaspace lock somewhere?

I think we should add aggregated counters in SpaceManager by chunk type to
not having to walk-and-count each time, but that is for another day. I have
a patch like that somewhere in my backlog.

..Thomas


More information about the hotspot-runtime-dev mailing list