On Wed, 19 Jan 2022 10:42:02 GMT, Peter Levart <plev...@openjdk.org> wrote:
> So, this patch is fine for making ClassCache more robust as a re-usable > component inside JDK (checking for non-null return of computeValue). The 2nd > change, that apparently shields against unbounded accumulation of garbage, > might not be enough in the sense that when garbage accumulated without > bounds, there would be not progress. So before the patch, we would at least > get an OOME and the loop would end. Now the loop could spin indefinitely. So > perhaps we must rather prevent this from happening in some other way... I > have an idea. Stay tuned. I think playing the catch-up race with GC (which we will eventually win, IMO) is better than obscure OOME. Note this matches other places we do the weak-reference loops, for example in `MethodType`: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/invoke/MethodType.java#L1390-L1401 ------------- PR: https://git.openjdk.java.net/jdk/pull/7092