On 10/24/2015 03:10 PM, Aradeonas wrote:
My question stand but I guess problem is in TObjectList but Im not sure
so I made a simple demo like this:
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
b: TButton;
begin
list := TObjectList.Create(True);
for i := 0 to 10000 do
begin
b := TButton.Create(Self);
list.Add(b);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
list.Clear;
list.Free;
end;
Form is clean and just have 2 button with their code so I run it and
memory usage in my Windows10 device is about 3mb and then hit the
button1 and memory goes up to 25mb and when I want to free and hit
button2 memory will decrease to 15mb not 3 , just like my main program
that I use TObjectList and will free its objects with remove
function but it will increase memory usage while running.
Did I miss something obvious?
Maybe TObjectlist.Clear does not free objects, in that case you have to
iterate through TObjectList and use Remove() which will free objects ?
zeljko
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus