Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Sat Feb 14 21:08:43 CET 2004

On Fri, 13 Feb 2004, Charl van Jaarsveldt wrote:

> Hi all,
> According to the docs for TObjectList, if it's OwnsObjects property is 
> set to true, then, if you clear the list, it will automatically call 
> free for all the objects contained in the list. At least that is how I 
> understand it.
> Now, I did a little test program and found that calling 
> TObjectList.clear actually does not call free for each object in the 
> list. If I run through the list and call free for each list manually it 
> works fine though.

I fixed this. The problem was that the behaviour of Borland's TList changed
- it got (a lot!) slower. In older TList implementations TList.Clear didn't 
do anything except free the memory for the list elements. 
Now it calls Notification for all elements in the list, which is a time 
consuming task. 

> So, here is the question: Is this normal behaviour? If so, when 
> precisely is the list elements going to be freed then? Must it always be 
> freed manually?
> I guess this is a problem I have with a couple of things in the FCL/VCL, 
> so an answer to this will be greatly appreciated! :-)

I have a fix in place, but can't currently test as someone else's work in 
the RTL currently stops me from compiling the Classes/Contnrs units.

As soon as the fix is committed, I'll notify the mailing list.


More information about the fpc-pascal mailing list