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

TextField: memory leak

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • fx2.1
    • fx2.1
    • javafx
    • Win7/JDK6/b07

      Sample to reproduce:

      /*
       * To change this template, choose Tools | Templates
       * and open the template in the editor.
       */
      package main;

      import javafx.application.Application;
      import javafx.application.Platform;
      import javafx.scene.Scene;
      import javafx.scene.control.TextField;
      import javafx.scene.layout.HBox;
      import javafx.stage.Stage;

      public class Main extends Application {

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


          @Override
          public void start(Stage stage) throws Exception {
              stage.setScene(new MainScene());
              stage.show();
          }

          class MainScene extends Scene {

              public MainScene() {
                  super(new HBox(), 1024, 600);

                  new Thread(new Runnable() {
                      public void run() {
                          for (int i = 0; i < 2000; i++) {
                              try {
                                  Thread.sleep(100);
                              } catch (InterruptedException ex) {
                              }
                              Platform.runLater(new Runnable() {
                                  public void run() {
                                      prepareScene();
                                  }
                              });
                          }
                      }
                  }).start();
              }

              private void prepareScene() {
                  HBox root = (HBox) getRoot();
                  root.getChildren().clear();
                  root.getChildren().add(new TextField());
              }
          }
      }

        1. TextFielLeak.png
          TextFielLeak.png
          13 kB
        2. screenshot-1.jpg
          screenshot-1.jpg
          42 kB
        3. jconsole.png
          jconsole.png
          88 kB

            leifs Leif Samuelsson (Inactive)
            ogb Oleg Barbashov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: