RFR: 8339341: SurfaceManager cacheMap retains strong references [v4]

Phil Race prr at openjdk.org
Thu Oct 17 18:46:52 UTC 2024


On Thu, 19 Sep 2024 11:54:56 GMT, Nikita Gubarkov <ngubarkov at openjdk.org> wrote:

>> I moved SurfaceDataProxy cache into a separate class.
>> Now caching level is determined by placement of the SurfaceManager.ProxyCache object instead of a "proxy key". This cache "owns" proxies and therefore strong refs via them do not prevent the cache and GraphicsConfig from being detected as weakly reachable.
>
> Nikita Gubarkov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Revert wildcard import in X11GraphicsDevice

Marked as reviewed by prr (Reviewer).

src/java.desktop/share/classes/sun/awt/image/SurfaceManager.java line 102:

> 100:      * and this map is just a weak mapping for the bookkeeping purposes.
> 101:      */
> 102:     private final Map<ProxyCache, WeakReference<SurfaceDataProxy>> weakCache = new WeakHashMap<>(2);

why does this one not need to be a synchronized map ?

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

PR Review: https://git.openjdk.org/jdk/pull/20825#pullrequestreview-2326278042
PR Review Comment: https://git.openjdk.org/jdk/pull/20825#discussion_r1773979636


More information about the client-libs-dev mailing list