Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-02

TThread memory leak?

2 messages · 1 person · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lukas Gradl

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

---------------------------- software security networks Lukas Gradl <lazarus#ssn.at> Eduard-Bodem-Gasse 9 A - 6020 Innsbruck Tel: +43-720-300168-0 Fax: +43-512-341033-19 ----------------------------

Reply by email

Lukas Gradl
to Lukas Gradl

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

Show quoted text 49 lines
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
---------------------------- software security networks Lukas Gradl <lazarus#ssn.at> Eduard-Bodem-Gasse 9 A - 6020 Innsbruck Tel: +43-720-300168-0 Fax: +43-512-341033-19 ----------------------------

Reply by email