Am 10.05.2021 um 23:18 schrieb Ryan Joseph via fpc-devel:

On May 10, 2021, at 3:05 PM, Sven Barth via fpc-devel 
<fpc-devel@lists.freepascal.org> wrote:

Why should they? You pass the reference to a non-reference counted 
parameter/field/variable, the reference count is increased and then what? It 
sits there for the remaining life time of the program, because nothing 
decrements the reference count?
I see what you mean. The FGL containers also call Finalize though when the 
container is freed so it does indeed keep balanced.
But only if the generic container is indeed specialized with the refcounted type. If it's e.g. TObject then the whole thing is up in the air again, because the whole point is that we *don't* want to burden non-reference counted class types with the reference counting stuff (and the need to check at runtime whether the type is reference counted or not *is* a burden).

Regards,
Sven
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to