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?

At the moment, I am doing something like this :

var
   i : Integer;
   TempObject : TMyObject;
begin
     i := 0;
     //Go through the list of TMyObject objects
     while i < AList.Count do
     begin
          TempObject := AList.Items[i];
          FreeAndNil(TempObject);
          inc(i);
     end;
     //Finally free the TList object
     AList.Clear;

     if assigned(AList) then
        FreeAndNil(AList);

inherited Destroy;


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

Reply via email to