When executing the test below the memory consumption in the Task Manager grows up to 2GB within seconds on my test system - the issue does not occur when the stage style is changed from TRANSPARENT to UNDECORATED.
public class TransparentStageMemoryIssueTest extends Application
{
public static void main(String[] args)
{
Application.launch(args);
}
@Override
public void start(Stage stage)
{
System.err.println(System.getProperty("javafx.runtime.version"));
//stage.initStyle(StageStyle.UNDECORATED);
stage.initStyle(StageStyle.TRANSPARENT);
final BorderPane root = new BorderPane();
root.setStyle("-fx-background-color:#808080;-fx-background-radius:30;-fx-border-radius:30;-fx-border-width:14;-fx-border-color:blue;");
Scene scene = new Scene(root, 800, 600);
stage.setScene(scene);
stage.setX(10);
stage.setY(10);
stage.show();
new Thread()
{
public void run()
{
for (int i = 0; i < 1000; i++)
{
Platform.runLater(new Runnable()
{
@Override
public void run()
{
int minSize = 500;
int maxSize = 1000;
int w = minSize + new Random().nextInt(maxSize - minSize);
int h = minSize + new Random().nextInt(maxSize - minSize);
Window win = root.getScene().getWindow();
win.setWidth(w);
win.setHeight(h);
}
});
try
{
sleep(50);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
};
}.start();
}
}