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

FontManager.fileCloser may cause memory leak in applets

    Details

    • Subcomponent:
      2d
    • Resolved In Build:
      b03
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        FontManager creates fileCloser to be executed at shutdown.

        In applet environment this may be triggered from the application context and then contextClassLoader will be refering to applet's classloader.
        This prevents classes loaded by this classloader from being unloaded (and their static state!) until thread is disposed.

        However, in plugin same VM is reused for other apps and shutdown hook may be not be called for long period of time.

        For FX applet this may cause leak of 10-20Mb depending on what applet was run first.

        Here is the example of reference chains from the memory dump:

        System Class Reference :
        --> class sun.font.FontManager (84 bytes) (static field fileCloser:)
        --> java.lang.Thread@0x281c3f70 (104 bytes) (field contextClassLoader:)
        --> sun.plugin2.applet.JNLP2ClassLoader@0x27f08078 (136 bytes) (field classes:)
        --> java.util.Vector@0x27f1bd10 (24 bytes) (field elementData:)
        --> [Ljava.lang.Object;@0x283241e0 (5128 bytes) (Element 200 of [Ljava.lang.Object;@0x283241e0:)
        --> class reversi.Main (84 bytes) (static field $titleImage:)
        --> javafx.scene.image.ImageView@0x2814a7c0 (466 bytes) (field $platformImage:)
        --> java.awt.image.BufferedImage@0x27f9a208 (37 bytes) (field raster:)
        --> sun.awt.image.IntegerInterleavedRaster@0x27f9acf8 (101 bytes) (field dataBuffer:)
        --> java.awt.image.DataBufferInt@0x27f9bde8 (36 bytes)

        System Class Reference :
        --> class java.lang.ApplicationShutdownHooks (84 bytes) (static field hooks:)
        --> java.util.IdentityHashMap@0x27f14ec8 (36 bytes) (field table:)
        --> [Ljava.lang.Object;@0x27f35fa8 (264 bytes) (Element 18 of [Ljava.lang.Object;@0x27f35fa8:)
        --> java.lang.Thread@0x281c3f70 (104 bytes) (field contextClassLoader:)
        --> sun.plugin2.applet.JNLP2ClassLoader@0x27f08078 (136 bytes) (field classes:)
        --> java.util.Vector@0x27f1bd10 (24 bytes) (field elementData:)
        --> [Ljava.lang.Object;@0x283241e0 (5128 bytes) (Element 200 of [Ljava.lang.Object;@0x283241e0:)
        --> class reversi.Main (84 bytes) (static field $titleImage:)
        --> javafx.scene.image.ImageView@0x2814a7c0 (466 bytes) (field $platformImage:)
        --> java.awt.image.BufferedImage@0x27f9a208 (37 bytes) (field raster:)
        --> sun.awt.image.IntegerInterleavedRaster@0x27f9acf8 (101 bytes) (field dataBuffer:)
        --> java.awt.image.DataBufferInt@0x27f9bde8 (36 bytes)

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  bae Andrew Brygin
                  Reporter:
                  igor Igor Nekrestyanov (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: