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

Win: Huge Memory Consumption for Transparent Stage

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8u40
    • 8
    • javafx
    • Tested on Win7 64, 8GB with FX8b116.

      When executing the test below the memory consumption in the Task Manager grows up to 2GB within seconds on my test system - the issue does not occur when the stage style is changed from TRANSPARENT to UNDECORATED.

          public class TransparentStageMemoryIssueTest extends Application
          {
            public static void main(String[] args)
            {
              Application.launch(args);
            }
            @Override
            public void start(Stage stage)
            {
              System.err.println(System.getProperty("javafx.runtime.version"));
              //stage.initStyle(StageStyle.UNDECORATED);
              stage.initStyle(StageStyle.TRANSPARENT);
              final BorderPane root = new BorderPane();
              root.setStyle("-fx-background-color:#808080;-fx-background-radius:30;-fx-border-radius:30;-fx-border-width:14;-fx-border-color:blue;");
              Scene scene = new Scene(root, 800, 600);
              stage.setScene(scene);
              stage.setX(10);
              stage.setY(10);
              stage.show();
              new Thread()
              {
                public void run()
                {
                  for (int i = 0; i < 1000; i++)
                  {
                    Platform.runLater(new Runnable()
                    {
                      @Override
                      public void run()
                      {
                        int minSize = 500;
                        int maxSize = 1000;
                        int w = minSize + new Random().nextInt(maxSize - minSize);
                        int h = minSize + new Random().nextInt(maxSize - minSize);
                        Window win = root.getScene().getWindow();
                        win.setWidth(w);
                        win.setHeight(h);
                      }
                    });
                    try
                    {
                      sleep(50);
                    }
                    catch (InterruptedException e)
                    {
                      e.printStackTrace();
                    }
                  }
                };
              }.start();
            }
          }

            flar Jim Graham
            wzberger Wolfgang Zitzelsberger
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: