RFR: 8378607: GlyphLayout cache can prevent Fonts from being GC'd
Daniel Gredler
dgredler at openjdk.org
Fri Feb 27 13:14:20 UTC 2026
On Wed, 25 Feb 2026 00:52:24 GMT, Phil Race <prr at openjdk.org> wrote:
> Update a cache in GlyphLayout.java to use a WeakHashMap
> The maximum cache size is also reduced.
> The intention is to allow Fonts loaded via Font.createFont() to be collected once the application drops references.
I'm not sure about the thread safety of `cacheRef`. Is there a reason that it's not declared final and initialized immediately in the declaration? It's inside of `SDCache`, so it wouldn't be initialized unless needed anyway (nested static class lazy init).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29904#issuecomment-3972890895
More information about the client-libs-dev
mailing list