[Lazarus] Tpicture.LoadFromFile leaking memory under linux/gtk2?
Luca Olivetti
luca at wetron.es
Mon Oct 11 09:14:38 CEST 2010
En/na Luca Olivetti ha escrit:
> I'm not sure it is a bug, so I'm asking here before reporting it as such.
>
> this code:
>
> procedure TForm1.Timer1Timer(Sender: TObject);
> begin
> timer1.enabled:=false;
> while not Application.Terminated do
> begin
> image1.Picture.loadfromfile('test.png');
> Label1.Tag:=Label1.Tag+1;
> Label1.Caption:=IntToStr(Label1.Tag);
> Application.ProcessMessages;
> end;
> end;
>
> works perfectly under windows, but under linux/gtk2 the application is
> using more and more memory (slowly but constantly, until the OOM kills
> it) both for the application itself and for X.
> Of course heaptrc reports no leak, using cmem doesn't help.
>
> Before you ask, the application is not an interactive one, and the above
> construct is to avoid using a thread (which makes memory usage even
> worse), the real loop is like "read some data from the network, display
> it, application.processmessages". If I limit myself to update labels,
> memory usage stays constant, as soon as I try to use images (like the
> above example) memory usage starts growing.
>
> This happened both with an old svn revision (22350) with fpc 2.2.4 and
> with a version updated yesterday (27607) with fpc 2.4.0.
I worked around the problem by caching the images in memory instead of
loading them every time, but I'd like to know where the above is leaking
memory.
Bye
--
Luca Olivetti
Wetron Automatización S.A. http://www.wetron.es/
Tel. +34 93 5883004 (Ext.133) Fax +34 93 5883007
More information about the Lazarus
mailing list