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

ImageView / Image - Memory Leak

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: fx2.1
    • Fix Version/s: fx2.1
    • Component/s: javafx
    • Environment:

      Windows

      Description

      I've seen a memory leak that I confirmed also under JavaFX 2.1.0-beta-b19 on top of Java 1.6. Basically I have a JavaFX application in which I display through an ImageView object a different JPEG image every 30 seconds. The relevant code looks like,

      inputStream = ClassLoader.getSystemResourceAsStream(...
      imageView.setImage(new Image(inputStream));
      ...
      inputStream.close();

      Unfortunately, when running the application with the NetBeans memory profiler it shows that the image bytes are never garbage collected resulting in a significant memory leak. Every time an image is loaded NetBeans reports that the number of allocated objects of the class 'sun.net.www.protocol.file.FileURLConnection' increases by one, also the image data continuously increase in memory throughout the application execution time as byte[] data.

      I have also attached a quick test application (ImageTest.java) that reproduces the described memory leak.

        Attachments

        1. ImageTest.java
          2 kB
        2. ImageTest.zip
          689 kB
        3. RT-20757-screen-1.png
          RT-20757-screen-1.png
          398 kB
        4. RT-20757-screen-2.png
          RT-20757-screen-2.png
          92 kB

          Activity

            People

            • Assignee:
              psafrata Pavel Ĺ afrata
              Reporter:
              cbohorisjfx Christos Bohoris (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: