JDK-8216377 : JavaFX: memoryleak for initial nodes of Window
  • Type: Bug
  • Component: javafx
  • Sub-Component: scenegraph
  • Affected Version: openjfx11
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: x86_64
  • Submitted: 2019-01-07
  • Updated: 2021-06-09
  • Resolved: 2019-01-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
openjfx11.0.12Fixed
Related Reports
Relates :  
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
While working on an update for JPro, I've found a memory-leak in JavaFX. 
It's a regression and doesn't happen on JavaFX8

The initial nodes of a Scene are not collected by the GC when they are removed from the Scene.
They get collected when the initial Window is closed, but this is not the expected behavior.

Affected JavaFX versions: 9 10 11
How to reproduce: My pull request will contain a simple UnitTest.

I've got a fix ready, I'm now creating a pull request.

REGRESSION : Last worked in version 8u181

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
How to reproduce: My pull request will contain a simple UnitTest.


FREQUENCY : always



Comments
Changeset: eedba0ab9a0b Author: kcr Date: 2019-01-22 09:08 -0800 URL: http://hg.openjdk.java.net/openjfx/jfx-dev/rt/rev/eedba0ab9a0b 8216377: Fix memoryleak for initial nodes of Window 8207837: Indeterminate ProgressBar does not animate if content is added after scene is set on window Summary: Add or remove the windowShowingChangedListener when the scene changes Reviewed-by: arapte, kcr Contributed-by: fk@sandec.de
22-01-2019

In addition to causing a leak, this same bug also causes an indeterminate ProgressBar to fail to animate in some cases. See JDK-8207837.
11-01-2019

Based on the analysis in the pull request, this is a regression introduced by the fix for JDK-8090322.
08-01-2019

This is under review on GitHub: https://github.com/javafxports/openjdk-jfx/pull/342
08-01-2019

Submitter provided JUnit Test (InitialNodesMemoryLeakTest.java) Windows 10, 64-bit JDK results: -------------------- 8u192-b12 : Pass 8u202-b07 : Pass 9b126 : Pass 9b127 : Fail <== regression 9.0.4+11 : Fail openjfx 12-ea+7: Fail >set PATH_TO_FX="D:\JDK\Openjfx\12-ea+7\javafx-sdk-12\lib" >javac --module-path %PATH_TO_FX% --add-modules=javafx.controls -cp D:\jars\org.junit.jar;. InitialNodesMemoryLeakTest.java >java --module-path %PATH_TO_FX% --add-modules=javafx.controls -cp D:\jars\org.junit.jar;. org.junit.runner.JUnitCore InitialNodesMemoryLeakTest JUnit version 4.8.1 .got: Group@339d9943 E Time: 5.941 There was 1 failure: 1) testCleanup(InitialNodesMemoryLeakTest) junit.framework.AssertionFailedError: Couldn't collect Node at junit.framework.Assert.fail(Assert.java:47) at junit.framework.Assert.assertTrue(Assert.java:20) at InitialNodesMemoryLeakTest.testCleanup(InitialNodesMemoryLeakTest.java:74) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:24) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at org.junit.runner.JUnitCore.run(JUnitCore.java:136) at org.junit.runner.JUnitCore.run(JUnitCore.java:117) at org.junit.runner.JUnitCore.runMain(JUnitCore.java:98) at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:53) at org.junit.runner.JUnitCore.main(JUnitCore.java:45) FAILURES!!! Tests run: 1, Failures: 1
08-01-2019