[fpc-pascal]TObjectList.free

Charl van Jaarsveldt charlvj at ict.om.org
Fri Feb 13 17:35:32 CET 2004


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.

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! :-)

Regards,
Charl





More information about the fpc-pascal mailing list