Don't use While if you don't need to.  A For loop is more efficient. 
Also don't use FreeAndNil if you will not be referencing the objects 
again, which you won't be.  Just use Free.  You also do not need to 
dereference the objects to free the memory.

var
    i : Integer;
begin
      for i := 0 to AList.Count do
         AList.Items[i].Free;
      AList.Free;
      inherited Destroy;
end;

Ross.

----- Original Message ----- 
From: "Tim" <[EMAIL PROTECTED]>
To: "Borland's Delphi Discussion List" <[email protected]>
Sent: Tuesday, March 15, 2005 7:02 PM
Subject: Re: Working with TList objects


At 11:51 14/03/2005, you wrote:

> > I understand that TList is a list of pointers. What I cannot 
> > understand is

Thanks for all the advice - I have made the changes, and am much happier
with the result.

Can anyone show me how to efficiently free all the memory used by the 
list
and its' objects?



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.2 - Release Date: 11/03/2005


_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to