[Lazarus] Problem with threads in Lazarus 0.9.24

Lee Jenkins lee at datatrakpos.com
Sun May 18 18:53:40 CEST 2008


Petr Hložek wrote:
> Hello,
> 
> my application uses threads.
> I have created TStringList for data exchange. It is global variable. If
> I receive any data from telnet connection I put it into this string list
> and create thread if is not already created.
> Thread read and delete this data from StringList. If I run my program,
> connect to telnet,  it takes about half hour and program crash with this
> error: Failed to create new thread
> I used to Lazarus 0.9.23cvs and I didnt have problem with it. Problem
> appears after upgrade to 0.9.24 :-(.
> 
> Dou you have any idea what can be wrong or what I should do better?
> Source code of my thread is here:
> http://cqrlog.svn.sourceforge.net/viewvc/cqrlog/fDXCluster.pas?view=markup
> 
> it start at line nr. 487 and body of the thread begins on line nr. 681.
> 

Petr,

I could be wrong, but I think I recall a mail list thread about threads.  Below 
is is a post from a little while ago.  Is it related maybe?

-- 

Warm Regards,

Lee

> OK - seems to be an fpc-bug - and the good news: Already fixed in 
> current 2.2.1.
> 
> In fpc 2.2.0 the TThread.FreeOnTerminate doesn't work as expected
> 
> regards
> 
> Lukas
> 
> Lukas Gradl schrieb:
>> > Hello!
>> > 
>> > I have some strange memory problem with a TThread-Descendant.
>> > For debugging I created a little test-app with a button on it and the 
>> > following OnClick-Handler:
>> > 
>> > procedure TForm1.Button1Click(Sender: TObject);
>> > begin
>> >    TThreadDummy.Create;
>> > end;
>> > 
>> > The Thread looks like that:
>> > 
>> > type
>> >    TThreadDummy=class(TThread)
>> >    protected
>> >      procedure Execute; override;
>> >    public
>> >      constructor Create;
>> >    end;
>> > 
>> > constructor TThreadDummy.Create;
>> > begin
>> >    inherited create(true);
>> >    FreeOnTerminate := true;
>> >    Resume;
>> > end;
>> > 
>> > procedure TThreadDummy.Execute;
>> > begin
>> >    //do nothing - just exit!
>> > end;
>> > 
>> > The program is compiled using FPC 2.2.0, Lazarus 0.9.24-0 precompiled 
>> > from Lazarus Page and Debian as OS
>> > 
>> > 
>> > 
>> > Every time I press the button, the program uses 8192 Bytes of memory 
>> > more (according to the ps-command). I've another app with a big TThread 
>> > descendant, which eats up the same 8192 on every TThreadDescendant.Create...
>> > 
>> > Anyone an idea what I might have done wrong?
>> > 
>> > 
>> > 
>> > regards
>> > Lukas
>> > 




More information about the Lazarus mailing list