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

Memory leak in ScrollPane

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • P4
    • Resolution: Duplicate
    • 8
    • 9
    • javafx
    • Win7 Java 8b106

    Description

      Execute the test below - when the scrollpane is removed it's still referenced so it can't get GC'd.

      public class ScrollPaneMemoryLeakTest extends Application
      {
        private MyScrollPane myPane;
        
        public static void main(String[] args)
        {
          Application.launch(args);
        }

        @Override
        public void start(Stage stage)
        {
          final FlowPane root = new FlowPane(10, 10);
          
          myPane = new MyScrollPane();
          root.getChildren().add(myPane);
          
          Button b = new Button("Remove Pane");
          b.setOnAction(new EventHandler<ActionEvent>()
          {
            @Override
            public void handle(ActionEvent event)
            {
              root.getChildren().remove(myPane);
              myPane = null;
            }
          });
          root.getChildren().add(b);
          
          Scene scene = new Scene(root, 800, 600);
          stage.setScene(scene);
          stage.show();
        }

        private static class MyScrollPane extends ScrollPane
        {
        }
      }

      Attachments

        Issue Links

          Activity

            People

              miflemi Mick Fleming
              wzberger Wolfgang Zitzelsberger
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: