On Fri, 10 Sep 2021 11:28:25 GMT, Marius Hanl <mh...@openjdk.org> wrote:
>> After updating to jfx 17, I detected memory leak in my application (every >> controller that has menu items won't get garbage collected after closing its >> stage), with visualvm I found it was caused by class >> ControlAcceleratorSupport. This kind of memory leak doesn't happen on jfx >> 16, so I guess there is something wrong with this PR. >> >> I've created a sample project that could reproduce and verify the memory >> leak: >> [jfx-test](https://github.com/RationalityFrontline/jfx-test/tree/ControlAcceleratorSupport) >> (on git branch ControlAcceleratorSupport). >> >> Run command `gradlew run` and you should see the following ui interface: >>  >> >> Clicking button `Call GC and Print MenuItems` will call `System.gc()` and >> print current ungarbaged menu items to console, clicking menu `Restart >> Stage` will call `Stage.close()` and launch a new same Stage. >> >> After clicking `Restart Stage` several times, click `Call GC and Print >> MenuItems`, you will see lots of ungarbaged menu items. However, by changing >> jfx version to 16 in `build.gradle.kts`, you will always see only one menu >> item. >> >> If menu items are set with action listeners, then these listeners also won't >> be garbage collected, typically these listeners hold references to >> controllers, which made all closed controllers leaked. This made jfx 17 >> unusable. > >> After updating to jfx 17, I detected memory leak in my application (every >> controller that has menu items won't get garbage collected after closing its >> stage), with visualvm I found it was caused by class >> ControlAcceleratorSupport. This kind of memory leak doesn't happen on jfx >> 16, so I guess there is something wrong with this PR. >> >> I've created a sample project that could reproduce and verify the memory >> leak: >> [jfx-test](https://github.com/RationalityFrontline/jfx-test/tree/ControlAcceleratorSupport) >> (on git branch ControlAcceleratorSupport). >> >> Run command `gradlew run` and you should see the following ui interface: >>  >> >> Clicking button `Call GC and Print MenuItems` will call `System.gc()` and >> print current ungarbaged menu items to console, clicking menu `Restart >> Stage` will call `Stage.close()` and launch a new same Stage. >> >> After clicking `Restart Stage` several times, click `Call GC and Print >> MenuItems`, you will see lots of ungarbaged menu items. However, by changing >> jfx version to 16 in `build.gradle.kts`, you will always see only one menu >> item. >> >> If menu items are set with action listeners, then these listeners also won't >> be garbage collected, typically these listeners hold references to >> controllers, which made all closed controllers leaked. This made jfx 17 >> unusable. > > Could you please report the bug at https://bugreport.java.com/ with a minimum > reproducible example (written in Java)? @Maran23 @kevinrushforth Bug reported via https://bugreport.java.com/bugreport/ with a minimum reproducible example written in Java, internal review ID : 9071415. ------------- PR: https://git.openjdk.java.net/jfx/pull/429