On Mon, 24 Feb 2020 10:16:55 GMT, dannygonzalez 
<github.com+6702882+dannygonza...@openjdk.org> wrote:

>>> So we need to keep the original behaviour from before where a count was 
>>> checked on every addListener call and the weak references were purged from 
>>> the array using the original calculation for this count.
>> 
>> The GC'd weak listeners do need to be purged, but why is the original 
>> behavior of the counters still applicable?
>
> Just wanted to keep a similar behaviour as before using the same calculation 
> based originally on the size of the listeners array list and now based on the 
> size of the map. So in theory the weak listeners should be trimmed at the 
> same rate as before.
> Happy to hear alternatives.

Also bear in mind that the trimming of weak listeners is extremely slow as it 
has to iterate through each listener performing the weak listener test. We 
can't call this every time we add a listener as this would lock up the JavaFX 
thread completely (I tried it). 
I assume this is why the original calculation was used where it backs of the 
rate the weak listener trimming code was called as the array list grew.

-------------

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

Reply via email to