-
Bug
-
Resolution: Fixed
-
P3
-
None
-
b21
This prevents otherwise unused objects to be garbage collected.
Namely, GraphicsConfiguration gets stuck in the cache as follows:
key -> GraphicsConfig
value -> SurfaceDataProxy -> GraphicsConfig
Therefore, just replacing the map with WeakHashMap is not sufficient.
Steps to reproduce:
1. Run attached GraphicsConfigLeakTest
2. Attach external display
3. Deattach external display
4. Take a heap dump and inspect incoming references for the graphics config objects
5. See old configs retained by the BufferedImage, like this:
- sun.java2d.metal.MTLGraphicsConfig
- key of java.util.concurrent.ConcurrentHashMap$Node
- java.util.concurrent.ConcurrentHashMap$Node[8]
- table of java.util.concurrent.ConcurrentHashMap
- cacheMap of sun.awt.image.BufImgSurfaceManager
- surfaceManager of java.awt.image.BufferedImage
- image of GraphicsConfigLeakTest
Namely, GraphicsConfiguration gets stuck in the cache as follows:
key -> GraphicsConfig
value -> SurfaceDataProxy -> GraphicsConfig
Therefore, just replacing the map with WeakHashMap is not sufficient.
Steps to reproduce:
1. Run attached GraphicsConfigLeakTest
2. Attach external display
3. Deattach external display
4. Take a heap dump and inspect incoming references for the graphics config objects
5. See old configs retained by the BufferedImage, like this:
- sun.java2d.metal.MTLGraphicsConfig
- key of java.util.concurrent.ConcurrentHashMap$Node
- java.util.concurrent.ConcurrentHashMap$Node[8]
- table of java.util.concurrent.ConcurrentHashMap
- cacheMap of sun.awt.image.BufImgSurfaceManager
- surfaceManager of java.awt.image.BufferedImage
- image of GraphicsConfigLeakTest
- links to
-
Commit(master) openjdk/jdk/fe83b7d5
-
Review(master) openjdk/jdk17u-dev/2990
-
Review(master) openjdk/jdk21u-dev/1077
-
Review(master) openjdk/jdk/20825