Question about JEP 371 and unloading Lambdas

Thomas Stüfe thomas.stuefe at
Tue Jun 9 08:46:15 UTC 2020


I currently try to understand how metaspace usage of Lambda proxies is
affected with JEP 371. Could you please confirm if my understanding is

Lambdas live as long as the lookup class lives, which would be the class
containing the lambda expression.

As for storage of metadata, in older JDKs Lambdas used anonymous classes,
which meant each lambda class had its own associated CLD. Since JEP 371
(?), the lambda class seems now directly associated with the CLD of the
loader of the lookup class. So, metaspace storage is more efficient since
we reuse the existing metaspace arena of the loader. I guess this makes
sense if the lifetime of the lambda is bound to that of the lookup class
anyway, since that won't be unloaded until its loader goes away (or, if it
itself is a hidden class, its CLD).

Have I got this right?

Thank you!


More information about the hotspot-runtime-dev mailing list