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());
}
}
}
/*
* 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());
}
}
}
- duplicates
-
JDK-8128520 TextInputControlSkin.caretTimeline is never stopped and causes memory leak
- Closed
- relates to
-
JDK-8087462 TabPane + TextField combination leaks memory
- Closed