RFR: 8302154: Hidden classes created by LambdaMetaFactory can't be unloaded [v2]

Jorn Vernee jvernee at openjdk.org
Fri Feb 17 21:25:26 UTC 2023


On Fri, 17 Feb 2023 20:01:08 GMT, Volker Simonis <simonis at openjdk.org> wrote:

> (because they are all not referenced from the program any more).

So, it sounds like this is testing a case where `LambdaMetafactory.metafactory` is being called directly?

I'd like to point out that, while I buy that people are doing this (I see enough of this on StackOverflow), `LambdaMetafactory` is a runtime API specifically designed to support a language feature. Calling it directly is an unintended use case. We should cater towards the intended use case instead (the language feature) which benefits from the strong tie to the class loader.

This change also seems to hurt the common case in favor of the rare case. The native memory cost should be multiplied by the ratio of use case that see a regression (lambdas) to the use cases that see an improvement (direct calls to LambdaMetafactory). I think it is safe to say that that ratio is quite large. i.e. we seem to be trading one regression for another, far worse one.

-------------

PR: https://git.openjdk.org/jdk/pull/12493


More information about the core-libs-dev mailing list