Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8116598

MacView instances aren't garbage collected due to existing references from ES2/Prism

    Details

      Description

      A fix for RT-17213 eliminated memory leaks in Glass code that prevented MacView instances from garbage collecting. However, there's still some leaks in ES2/Prism code present. Use the following instruction to reproduce the issue:

      > cd tests/performance/FXBenchmark
      > ant
      > ant build-native

      > cd tests/performance/GUIMark2
      > ant

      > java -Djava.library.path=../FXBenchmark/mac/ -cp ../../../import/benchmarks-2.1.1/benchmarks-2.1.1.jar:../FXBenchmark/dist/FXBenchmark.jar:dist/GUIMark2.jar
        jrockit.bm.Main guimark2.bm.BitmapBenchmark -i 5 -monsters 3000 -counters JFX_FPS MAX_MEMORY_USAGE

      Using jmap/jhat utilities the following reference chains are revealed:

      --> com.sun.glass.ui.mac.MacView@0x7f4562150 (99 bytes) (field pen:)
       --> com.sun.javafx.tk.quantum.PrismPen@0x7f4561ce8 (90 bytes) (field paintRunnable:)
       --> com.sun.javafx.tk.quantum.PaintRunnable@0x7f4562068 (168 bytes) (field presentable:)
       --> com.sun.prism.es2.ES2SwapChain@0x7f46aec10 (59 bytes) (field context:)
       --> com.sun.prism.es2.ES2Context@0x7f45f61d8 (260 bytes) (field recentCaches:)
       --> [Lcom.sun.prism.impl.GlyphCache;@0x7f4623d38 (80 bytes) (Element 0 of [Lcom.sun.prism.impl.GlyphCache;@0x7f4623d38:)
       --> com.sun.prism.impl.GlyphCache@0x7f45ef590 (69 bytes) (field packer:)
       --> com.sun.prism.impl.packrect.RectanglePacker@0x7f45ef530 (64 bytes) (field backingStore:)
       --> com.sun.prism.es2.ES2Texture@0x7f470caf0 (93 bytes) (field disposerRecord:)
       --> com.sun.prism.es2.ES2Texture$ES2TextureDisposerRecord@0x7f478c038 (36 bytes) (field renderingContext:)
       --> com.sun.prism.es2.ES2ViewRenderingContext@0x7f4842ed0 (48 bytes) (field state:)
       --> com.sun.prism.es2.ES2Context$State@0x7f46b7260 (148 bytes) (field lastRenderTarget:)
       --> com.sun.prism.es2.ES2SwapChain@0x7f4848c10 (59 bytes) (field view:)
       --> com.sun.glass.ui.mac.MacView@0x7f45e3638 (99 bytes)

      or

      --> com.sun.glass.ui.mac.MacMenuDelegate@0x7f45f1c98 (24 bytes) (??:)
       --> class com.sun.glass.ui.mac.MacMenuDelegate (160 bytes) (??:)
       --> sun.misc.Launcher$AppClassLoader@0x7f44ea380 (122 bytes) (field classes:)
       --> java.util.Vector@0x7f44ea3f8 (36 bytes) (field elementData:)
       --> [Ljava.lang.Object;@0x7f480e778 (10256 bytes) (Element 580 of [Ljava.lang.Object;@0x7f480e778:)
       --> class com.sun.prism.impl.Disposer (160 bytes) (static field disposerInstance:)
       --> com.sun.prism.impl.Disposer@0x7f455a560 (32 bytes) (field records:)
       --> java.util.Hashtable@0x7f455a5b0 (64 bytes) (field table:)
       --> [Ljava.util.Hashtable$Entry;@0x7f50504e0 (1544 bytes) (Element 48 of [Ljava.util.Hashtable$Entry;@0x7f50504e0:)
       --> java.util.Hashtable$Entry@0x7f484c548 (44 bytes) (field value:)
       --> com.sun.prism.es2.ES2Texture$ES2TextureDisposerRecord@0x7f478bf60 (36 bytes) (field renderingContext:)
       --> com.sun.prism.es2.ES2ViewRenderingContext@0x7f4842ed0 (48 bytes) (field state:)
       --> com.sun.prism.es2.ES2Context$State@0x7f46b7260 (148 bytes) (field lastRenderTarget:)
       --> com.sun.prism.es2.ES2SwapChain@0x7f4848c10 (59 bytes) (field view:)
       --> com.sun.glass.ui.mac.MacView@0x7f45e3638 (99 bytes)

      Note that the already hidden MacView instance is still referenced by the ES2SwapChain object, and hence cannot be garbage collected.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ckyang Chien Yang (Inactive)
                Reporter:
                anthony Anthony Petrov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: