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

Memory leak apparently due to SwingComponent.wrap().

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3
    • None
    • fx1.0
    • javafx

    Description

      Swing components wrapped with SwingComponent.wrap() are apparently not garbage collected. I'm attaching a program consisting of a JavaFX file and a Java file to reproduce. (To compile the Java file, I had to use javac -target "1.5").

      The scenario of the test program is as follows. You have a JavaFX node that shows slides built with Swing, which are created, wrapped and set in the JavaFX node every time you press a button. The "slides" are artificially big memory consumers in the test program. When I ran it, it didn't even get to slide # 11. The output follows.

      #freeMemory=1280656
      #freeMemory=4634560
      #freeMemory=3633200
      #freeMemory=7493296
      #freeMemory=2390248
      #freeMemory=15404040
      #freeMemory=10316832
      #freeMemory=5202592
      #freeMemory=20814208
      #freeMemory=15690520
      #freeMemory=10582320
      #freeMemory=5474344
      Exception in thread "AWT-EventQueue-1" java.lang.OutOfMemoryError: Java heap spa
      ce
      Exception in thread "AWT-EventQueue-1" java.lang.OutOfMemoryError: Java heap spa
      ce
      Exception in thread "AWT-EventQueue-1" java.lang.OutOfMemoryError: Java heap spa
      ce
      Exception in thread "AWT-EventQueue-1" java.lang.OutOfMemoryError: Java heap spa
      ce
      Exception in thread "AWT-EventQueue-1" java.lang.OutOfMemoryError: Java heap spa
      ce

      Attachments

        Activity

          People

            rbair Richard Bair (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: