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

Huge memory consumption when loading a large Image

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P2
    • None
    • 8u40
    • javafx
    • Windows 7

    Description

      Run this sample test program :

      "
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.image.Image;
      import javafx.scene.image.ImageView;
      import javafx.scene.layout.GridPane;
      import javafx.stage.Stage;

      public class HugeMemoryTest extends Application {

          @Override
          public void start(Stage primaryStage) {
              GridPane gridPane = new GridPane();
              ImageView imageView = new ImageView(new Image("chart.png"));
              gridPane.add(imageView, 0, 0);
              Scene scen = new Scene(gridPane);
              primaryStage.setScene(scen);
              primaryStage.show();
          }

          /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
              launch(args);
          }

      }"

      You will need this image http://i.imgur.com/N7yWVTV.png which is 5000x5000 but only weight 483ko.

      Run the program and you will see that your JRE is using nearly 100Mb for displaying one single Image. The blame is on HeapByteBuffer.

      I think it may be similar to RT-39386 but unsure. This is a serious issue.

      Attachments

        Activity

          People

            kcr Kevin Rushforth
            shadzic Samir Hadzic
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: