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

[MemoryLeak] RectBounds & PseudoClassState

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 8u40
    • Fix Version/s: 8u40
    • Component/s: javafx
    • Environment:

      Windows 7 64 bits

      Description

      Run this sample test :
      "
      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.Menu;
      import javafx.scene.control.MenuBar;
      import javafx.scene.control.MenuItem;
      import javafx.scene.layout.BorderPane;
      import javafx.stage.Stage;

      public class MenuButtontest extends Application {

          public static void main(String[] args) {
              Application.launch(MenuButtontest.class, args);
          }

          @Override
          public void start(Stage stage) {

              MenuBar bar = new MenuBar();
              Menu menu = new Menu("test");
              bar.getMenus().add(menu);

              MenuItem item = new MenuItem("lol");
              menu.getItems().add(item);
              
              Button button = new Button("add menu");
              button.setOnAction((ActionEvent event) -> {
                  bar.getMenus().clear();
                  bar.getMenus().add(menu);
              });
              BorderPane pane = new BorderPane(button);
              pane.setTop(bar);
              Scene scene = new Scene(pane);
              stage.setScene(scene);
              stage.show();

          }
      }
      "

      Now execute the program and run a memory profiler.
      Get to live result and inspect the class "RectBounds" of "com.sun.javafx.geom".

      Now every time you click on the button, which remove all Menus and add the same Menu, you have instance of RectBounds and PseudoClassState that are created.

      Some of them are trashed when you run the Garbage collector, but the number is growing.

      Can you confirm that this is a memory leak? If it's confirmed, I've seen quite a lot of these "RectBounds" left reachable when using Tooltip, Hbox, Menus etc.

      Tested with JDK 8u40 b15.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jgiles Jonathan Giles
                Reporter:
                shadzic Samir Hadzic
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: