RFR: 8241840: Memoryleak: Closed focused Stages are not collected with Monocle.

Florian Kirmaier fkirmaier at openjdk.java.net
Tue Apr 14 10:50:13 UTC 2020


On Tue, 7 Apr 2020 09:44:34 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

>> Closed focused Stages are not collected with Monocle
>> 
>> This commit adds a unit-test and a fix for collecting focused closed stages.
>> 
>> ticket: https://bugs.openjdk.java.net/browse/JDK-8241840
>
> tests/system/src/test/java/test/javafx/stage/FocusedWindowTest.java line 77:
> 
>> 76:         Platform.runLater(() -> stage.close());
>> 77:     }
>> 78:
> 
> Looks like the primary `stage` is not required for actual test, and this block is only used to initialize JavaFX
> runtime. Please check if it can be replaced by below block
>     ```
>     @BeforeClass
>     public static void initFX() throws Exception {
>             startupLatch = new CountDownLatch(1);
>             Platform.startup(startupLatch::countDown);
>             Assert.assertTrue("Timeout waiting for FX runtime to start",
>                     startupLatch.await(15, TimeUnit.MILLISECONDS));
>     }

This version doesn't work for me.
With this change, I get the following error:
test.javafx.stage.FocusedWindowTest > testLeak FAILED
    junit.framework.AssertionFailedError: Exceeded timeout limit of 10000 msec
        at test.util.Util.runAndWait(Util.java:163)
        at test.util.Util.runAndWait(Util.java:134)
        at test.javafx.stage.FocusedWindowTest.testLeak(FocusedWindowTest.java:82)

-------------

PR: https://git.openjdk.java.net/jfx/pull/153


More information about the openjfx-dev mailing list