RFR: 8341418: Prism/es2 DrawableInfo is never freed (leak) [v3]
Thiago Milczarek Sayao
tsayao at openjdk.org
Mon Oct 7 16:50:59 UTC 2024
> When creating a Scene, a `DrawableInfo` is allocated with `malloc`. When scene changes, this is called on `WindowStage.java`:
>
> `QuantumRenderer.getInstance().disposePresentable(painter.presentable); // latched on RT`
>
> But the underlying `DrawableInfo` is never freed.
>
> I also think this should be done when the Stage is closed.
>
> To test:
>
> import javafx.animation.Animation;
> import javafx.animation.KeyFrame;
> import javafx.animation.KeyValue;
> import javafx.animation.Timeline;
> import javafx.application.Application;
> import javafx.scene.Scene;
> import javafx.scene.control.TextField;
> import javafx.scene.control.Label;
> import javafx.scene.layout.Pane;
> import javafx.scene.layout.StackPane;
> import javafx.scene.layout.VBox;
> import javafx.scene.paint.Color;
> import javafx.stage.Stage;
> import javafx.util.Duration;
>
> public class TestScenes extends Application {
>
> @Override
> public void start(Stage stage) {
> Timeline timeline = new Timeline(
> new KeyFrame(Duration.millis(100), e -> stage.setScene(createScene("Scene 1", Color.RED))),
> new KeyFrame(Duration.millis(200), e -> stage.setScene(createScene("Scene 2", Color.BLUE))),
> new KeyFrame(Duration.millis(300), e -> stage.setScene(createScene("Scene 3", Color.GREEN)))
> );
>
> timeline.setCycleCount(Animation.INDEFINITE);
> timeline.play();
>
> stage.show();
> }
>
> private Scene createScene(String text, Color color) {
> return new Scene(new StackPane(), 400, 300, color);
> }
>
> public static void main(String[] args) {
> launch(TestScenes.class, args);
> }
> }
Thiago Milczarek Sayao has updated the pull request incrementally with one additional commit since the last revision:
Let `createGraphics` fail if called after dispose
-------------
Changes:
- all: https://git.openjdk.org/jfx/pull/1586/files
- new: https://git.openjdk.org/jfx/pull/1586/files/f5960383..ad27a8d9
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jfx&pr=1586&range=02
- incr: https://webrevs.openjdk.org/?repo=jfx&pr=1586&range=01-02
Stats: 5 lines in 1 file changed: 0 ins; 4 del; 1 mod
Patch: https://git.openjdk.org/jfx/pull/1586.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/1586/head:pull/1586
PR: https://git.openjdk.org/jfx/pull/1586
More information about the openjfx-dev
mailing list