On Thu, 12 Jan 2023 08:53:14 GMT, Florian Kirmaier <fkirma...@openjdk.org> wrote:
>> Making the initial listener of the ListProperty weak fixes the problem. >> The same is fixed for Set and Map. >> Due to a smart implementation, this is done without any performance drawback. >> (The trick is to have an object, which is both the WeakReference and the >> Changelistener) >> By implying the same trick to the InvalidationListener, this should even >> improve the performance of the collection properties. > > Florian Kirmaier has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains eight commits: > > - Merge remote-tracking branch 'origjfx/master' into > JDK-8277848-list-binding-leak > > # Conflicts: > # > modules/javafx.base/src/main/java/javafx/beans/property/ListPropertyBase.java > # > modules/javafx.base/src/main/java/javafx/beans/property/SetPropertyBase.java > # > modules/javafx.base/src/test/java/test/javafx/beans/property/SetPropertyBaseTest.java > - Merge remote-tracking branch 'origjfx/master' into > JDK-8277848-list-binding-leak > - JDK-8277848 > Added tests to ensure no premature garbage collection is happening. > - JDK-8277848 > Added 3 more tests to verify that a bug discussed in the PR does not > appear. > - JDK-8277848 > Added the 3 requests whitespaces > - JDK-8277848 > Further optimization based code review. > This Bugfix should now event improve the performance > - JDK-8277848 > Added missing change > - JDK-8277848 > Fixed memoryleak, when binding and unbinding a ListProperty. The same was > fixed for SetProperty and MapProperty. To my knowledge, many memory leaks, are not really possible to implement elegantly without weak references. For that reason, I usually come from the opposite direction, and ask myself, how can I test code with WeakReferences properly. ------------- PR: https://git.openjdk.org/jfx/pull/689