[Lazarus] TThread.WaitFor blocks the main event loop under Linux

Graeme Geldenhuys graemeg.lists at gmail.com
Fri Oct 8 15:17:51 CEST 2010


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.


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