On Wed, 17 Dec 2025 20:36:23 GMT, Roger Riggs <[email protected]> wrote:

> $.02, From the Valhalla point of view. As above, there is no reason for the 
> WeakHashMap. The object being cached is small so memory reclamation is not 
> the goal. The keys are small integers, currently cached so always exist, so 
> never freed and nothing is reclaimed. Its not clear why a map is used either 
> but maybe thought to be an easier APIs to manage the set. The simple switch 
> to another Map implementation should be very low risk. Regards, Roger

Thank you @RogerRiggs and @liach for the fast response!

> Also Integers, even before JDK 25, are cached internally for values -128 to 
> 127. This WeakHashMap will simply not work for any reasonable amount of 
> dividers, as those Integers will never be weakly reachable.

Excactly. Had the same thought.

> There is no need for this cache. Just create a Divider when one is set 

I had the same idea when I checked the code. This seems reasonable to me too.

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

PR Comment: https://git.openjdk.org/jfx/pull/2010#issuecomment-3674857822

Reply via email to