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

TabPane + TextField combination leaks memory

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 7-pool, 8u40
    • Fix Version/s: 9
    • Component/s: javafx
    • Environment:

      MacOS 10.6 + 64bit JDK

      Description

      I've found this bug while investigating a leak in the Browser demo. Below is a minimized test. To reproduce, I ran the test under profiler and selected tabs one by one. On each tab I clicked into the text field and typed a few letters into it. Then I closed all tabs except Tab0, and created a heap dump (attached as TextFieldLeak.hprof).

      The dump shows five TextField objects (there should be only one), three of them are referenced from QuantumToolkit.animationRunnable. I suppose this may be related to the blinking caret.

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Tab;
      import javafx.scene.control.TabPane;
      import javafx.scene.control.TextField;
      import javafx.stage.Stage;

      public class Test extends Application {

          @Override public void start(Stage stage) {
              TabPane tabs = new TabPane();
              for (int i=0; i<5; i++) {
                  TextField field = new TextField("Field" + i);
                  Tab tab = new Tab("Tab" + i);
                  tab.setContent(field);
                  tabs.getTabs().add(tab);
              }
              stage.setScene(new Scene(tabs));
              stage.sizeToScene();
              stage.show();
          }

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ckyang Chien Yang (Inactive)
                Reporter:
                peterz Peter Zhelezniakov
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: