RFR: 8227619: Potential memory leak in javafx.scene.control.ListView

Kevin Rushforth kcr at openjdk.java.net
Sat Feb 8 17:08:26 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.

OK, this makes sense. Somewhat related to this, I see that `ListViewBitSetSelectionModel` is using a `WeakInvalidationListener` in order to avoid a similar problem.


Marked as reviewed by kcr (Lead).

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

More information about the openjfx-dev mailing list