-
Backport
-
Resolution: Fixed
-
P3
-
8, 8u20
-
b05
Animation + resizing leads to OOM error in javafx2, so it's partial backport of 8096749 to javafx2.
test case:
import javafx.animation.Animation;
import javafx.animation.AnimationTimer;
import javafx.animation.FadeTransition;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.util.Duration;
public class TransparentStage extends Application {
public static final int MAX_WIDTH = 1920;
public static final int MAX_HEIGHT = 1080;
public static final int MIN_WIDTH = 10;
public static final int MIN_HEIGHT = 10;
@Override
public void start(final Stage stage) {
stage.initStyle(StageStyle.TRANSPARENT);
Text text = new Text("Transparent!");
text.setFont(new Font(40));
VBox box = new VBox();
box.getChildren().add(text);
final Scene scene = new Scene(box, MAX_WIDTH, MAX_HEIGHT);
scene.setFill(null);
stage.setScene(scene);
stage.show();
Rectangle rect = new Rectangle(MAX_WIDTH, MAX_HEIGHT);
rect.setFill(Color.SALMON);
rect.setOpacity(0);
box.getChildren().add(rect);
AnimationTimer animationTimer = new AnimationTimer() {
@Override
public void handle(long now) {
final double width = stage.getWidth();
final double height = stage.getHeight();
final double newWidth = (MIN_WIDTH + width + 10)% MAX_WIDTH;
final double newHeight = (MIN_HEIGHT + height + 10)% MAX_HEIGHT;
stage.setWidth(newWidth);
stage.setHeight(newHeight);
}
};
animationTimer.start();
FadeTransition ft = new FadeTransition(Duration.seconds(5), rect);
ft.setToValue(1);
ft.setCycleCount(100);
ft.play();
}
public static void main(String[] args) {
launch(args);
}
}
To reproduce the issue you need to run jvm with the following args: -Xms1000m -Xmx1000m
test case:
import javafx.animation.Animation;
import javafx.animation.AnimationTimer;
import javafx.animation.FadeTransition;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.util.Duration;
public class TransparentStage extends Application {
public static final int MAX_WIDTH = 1920;
public static final int MAX_HEIGHT = 1080;
public static final int MIN_WIDTH = 10;
public static final int MIN_HEIGHT = 10;
@Override
public void start(final Stage stage) {
stage.initStyle(StageStyle.TRANSPARENT);
Text text = new Text("Transparent!");
text.setFont(new Font(40));
VBox box = new VBox();
box.getChildren().add(text);
final Scene scene = new Scene(box, MAX_WIDTH, MAX_HEIGHT);
scene.setFill(null);
stage.setScene(scene);
stage.show();
Rectangle rect = new Rectangle(MAX_WIDTH, MAX_HEIGHT);
rect.setFill(Color.SALMON);
rect.setOpacity(0);
box.getChildren().add(rect);
AnimationTimer animationTimer = new AnimationTimer() {
@Override
public void handle(long now) {
final double width = stage.getWidth();
final double height = stage.getHeight();
final double newWidth = (MIN_WIDTH + width + 10)% MAX_WIDTH;
final double newHeight = (MIN_HEIGHT + height + 10)% MAX_HEIGHT;
stage.setWidth(newWidth);
stage.setHeight(newHeight);
}
};
animationTimer.start();
FadeTransition ft = new FadeTransition(Duration.seconds(5), rect);
ft.setToValue(1);
ft.setCycleCount(100);
ft.play();
}
public static void main(String[] args) {
launch(args);
}
}
To reproduce the issue you need to run jvm with the following args: -Xms1000m -Xmx1000m
- backport of
-
JDK-8096749 OutOfMemoryError with FadeTransition under certain circumstances
-
- Resolved
-