Does the following code have a memory leak ?

type
  rRecord = record
    i : integer;
    str : string;
  end;

  pRecord = ^rRecord;


procedure TForm1.testForLeak;
var
  i : integer;
  s : string;
  pnt : pRecord;
  list : Tlist;

begin
  list := Tlist.create;
  for i := 0 to 1000000 do
    begin
    new(pnt);
    pnt.l1 := 1;
    pnt.l2 := 'a';
    list.Add(pnt);
    end;

  for i := 0 to list.Count -1 do
    begin
    dispose(list.Items[i]);
    end;

  list.Clear;
  list.free;
  end;

end;


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

Reply via email to