FULL PRODUCT VERSION :
ADDITIONAL OS VERSION INFORMATION :
Windows (multiple)
Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
Tested with multiple JDK8 versions in 64 bit.
A DESCRIPTION OF THE PROBLEM :
There happens to be a memory leak when using JavaFX in combination with the software rendering pipeline (-Dprism.order=sw). The leak does NOT occur when using hardware rendering (-Dprism.order=d3d).
Our analysis came to the result that the cause of this memory leak seems to be the class JavaSurface. This class gets created by the JavaFX renderer but is not cleaned up. The finalize() method of the class does not get called anytime.
As the class JavaSurface contains an INT buffer which can be bigger than 1 MB, the impacts of this leak are tremendous. Each switch between different views increases the memory usage by about 0.5 MB to 1.5 MB (in our case).
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ScrollBar;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class LeakProducer extends Application
{
@Override
public void start(Stage primaryStage) throws Exception
{
final StackPane root = new StackPane();
final VBox myBox = new VBox();
Button scrollBarBtn = new Button();
scrollBarBtn.setText("Scrollbar");
scrollBarBtn.setOnAction(x -> {
if (myBox.getChildren().size() > 1) {
myBox.getChildren().remove(1);
System.gc();
System.runFinalization();
System.gc();
System.runFinalization();
} else {
myBox.getChildren().add(new ScrollBar());
}
});
Scene scene = new Scene(root, 300, 250);
myBox.getChildren().add(scrollBarBtn);
root.getChildren().add(myBox);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String args[]) {
launch(args);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use hardware rendering (d3d) or deprecated j2d pipeline.
ADDITIONAL OS VERSION INFORMATION :
Windows (multiple)
Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
Tested with multiple JDK8 versions in 64 bit.
A DESCRIPTION OF THE PROBLEM :
There happens to be a memory leak when using JavaFX in combination with the software rendering pipeline (-Dprism.order=sw). The leak does NOT occur when using hardware rendering (-Dprism.order=d3d).
Our analysis came to the result that the cause of this memory leak seems to be the class JavaSurface. This class gets created by the JavaFX renderer but is not cleaned up. The finalize() method of the class does not get called anytime.
As the class JavaSurface contains an INT buffer which can be bigger than 1 MB, the impacts of this leak are tremendous. Each switch between different views increases the memory usage by about 0.5 MB to 1.5 MB (in our case).
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ScrollBar;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class LeakProducer extends Application
{
@Override
public void start(Stage primaryStage) throws Exception
{
final StackPane root = new StackPane();
final VBox myBox = new VBox();
Button scrollBarBtn = new Button();
scrollBarBtn.setText("Scrollbar");
scrollBarBtn.setOnAction(x -> {
if (myBox.getChildren().size() > 1) {
myBox.getChildren().remove(1);
System.gc();
System.runFinalization();
System.gc();
System.runFinalization();
} else {
myBox.getChildren().add(new ScrollBar());
}
});
Scene scene = new Scene(root, 300, 250);
myBox.getChildren().add(scrollBarBtn);
root.getChildren().add(myBox);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String args[]) {
launch(args);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use hardware rendering (d3d) or deprecated j2d pipeline.
- duplicates
-
JDK-8163257 Leaking com.sun.pisces.JavaSurface instances in software rendering mode
-
- Closed
-