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

Huge memory consumption when loading a large Image

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Not an Issue
    • Affects Version/s: 8u40
    • Fix Version/s: None
    • Component/s: javafx
    • Environment:

      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

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

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: