RFR: 8252811: The list of cells in a VirtualFlow is cleared every time the number of items changes

Ajit Ghaisas aghaisas at openjdk.java.net
Fri Sep 18 11:09:59 UTC 2020

On Tue, 8 Sep 2020 12:43:19 GMT, Johan Vos <jvos at openjdk.org> wrote:

>> This PR removes an old fix (RT-13965/JDK-8113318), which was applied in 2011 to avoid a memory leak in
>> `VirtualFlow::sheetChildren`, after new items were constantly added.
>> With the current VirtualFlow implementation, there are in place the necessary methods that take care of cleaning or
>> adding new cells to the sheetChildren list, and such memory leak doesn't exist, the size remains constant when new
>> items are added or removed (see included unity test).   The call to `sheetchildren.clear()`, on the contrary, has a big
>> impact in performance and CPU usage, when new items are constantly added, as has been reported in JDK-8185886/#108.
> This looks ok to me. It would be ideal to have the test failing before JDK-8113318 was applied, as that would show the
> issue for which JDK-8113318 was created is now fixed. But I do understand it is very hard to apply this test to a code
> snapshot from 2011.

As there is no automated test to make sure we are not re-introducing the leak, I have verified by running Ensemble8
KeyEvent sample mentioned in JDK-8113318 and typing more than 800 keys. There is no performance degradation observed.

The change and test looks OK.


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

More information about the openjfx-dev mailing list