RFR: 8227619: Potential memory leak in javafx.scene.control.ListView
kcr at openjdk.java.net
Wed Feb 5 23:29:58 UTC 2020
On Fri, 10 Jan 2020 08:17:12 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:
> `ListView` does not get GCed because `SelectedItemsReadOnlyObservableList` adds a `ListChangeListener` to the (`ObservableList`) items of `ListView`.
> Adding a `WeakListChangeListener` instead of `ListChangeListener` fixes the issue.
> Added a unit test and verified that existing tests do not fail due to this change.
Presuming that using a weak reference causes no other issues, the fix looks fine and will resolve the leak. How confident are you that there are no cases where the listener might be prematurely garbage collected?
More information about the openjfx-dev