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

Memory Leak in Scene

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • None
    • fx2.1
    • javafx
    • None

    Description

      See here:
      https://forums.oracle.com/forums/thread.jspa?threadID=2407365

      I have a similar issue, too, where I reuse the stage with different scenes.


      The following example doesn't make sense, but shows the memory leak. (just change the loop count).


      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;


      public class TestApp extends Application {


          public static void main(String[] args) throws Exception {
              launch();
          }

          public void start(final Stage stage) throws Exception {

              for (int i = 0; i < 4000; i++) {
                  stage.setScene(new Scene(new VBox()));
              }
              System.gc();
              System.out.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 + " KB");

              stage.show();
          }
      }

      Attachments

        Issue Links

          Activity

            People

              lnerad Ľubomír Nerád (Inactive)
              cschudtjfx Christian Schudt (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: