Java progress in a simple JavaFX application with a ProgressBar or ProgressIndicator, whose progress is set to -1 (INDETERMINATE_PROGRESS), gradually uses more and more memory until it fills both ram and swap in just a few minutes.
I am using Fedora 23 x86_64 with the latest updates, kernel-4.4.5-300.fc23.x86_64 and jdk1.8.0_74. The same problem occurs with kernel-4.2.3-300.fc23.x86_64 and both jdk1.8.0_73 and jdk1.8.0_45.
I ran into this problem in my project, and this happens even in a simple application:
package sample;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ProgressIndicator;
import javafx.stage.Stage;
public class ProgressBarMemoryLeak extends Application {
ProgressIndicator progress = new ProgressIndicator(-1);
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setScene(new Scene(progress, 100, 100));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Is there any way to overcome this problem?
Maybe there is another custom implementation of ProgressBar that I can use instead?