Hi! Could you help me please to solve this problem. Here is my code. I Store (in this example) 10000 strings and when I try to delete them only some amount of memory is freed the rest leaks.
type
PMyData = ^TMyData;
TMyData = record
Name: string;
end;
////////
var
XList:Tlist;
//////////
// Here is how I add//
var
MyData: PMyData;
I:Integer;
begin
for I:=0 to 10000 do begin
New(MyData);
MyData.Name:='Hello';
XList.Add(TObject(MyData));
end;
end;
///Here is how I delete///
var
MyData: PMyData;
I:Integer;
begin
for I:= XList.Count - 1 downto 0 do begin
MyData:=PMyData (XList[I]); /// I also used (XList.Items[I]) but the result is the same
Dispose(MyData);
XList.Delete(I);
end;