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

Win: Huge Memory Consumption for Transparent Stage

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8u40
    • Component/s: javafx
    • Environment:

      Tested on Win7 64, 8GB with FX8b116.

      Description

      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();
            }
          }

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: