Giuliano Colla wrote:
> Al Boldi ha scritto:
> > For now, when you start a thread non-suspended, TThread.Execute(false),
> > can you see the memory increase for your project1 app when checking with
> > top? Then, when you TThread.WaitFor/TThread.Free, does it decrease?  And
> > by how much?
> >
> > Below is the simplified console app.
> >
> >
> > Thanks for the feedback!
>
> Feedback:
> I couldn't see any change with top, so I slightly modified your console
> app, by adding:
>
>   writeln('Type <Enter> to start thread');
>
>   readln(ans);
>
> before
>
>   t1:=TThreadBug.Create(false);

Ok, much better!

> With Lazarus 0.9.4.1, fpc 2.2.0 the result is the following:
> before starting the thread TOP says:
>
> 4732 colla     16   0  2564  808  488 S    0  0.1   0:00.00 threadbug
>
> after the thread is started it becomes:
>
> 4732 colla     15   0 12860  916  576 S    0  0.1   0:00.00 threadbug

That's a huge increase; almost 12mb.  On fpc2.0.2/linux2.6.22 it increases by 
~2mb, a lot less, but still large.

Can somebody check what the gcc thread overhead is?

> and it doesn't change anymore until program termination, either typing y
> or n.

If this is with v2.2.0, then this means a regression on top of a bug.

> I tried to set true FreeOnTerminate of your thread (with proper
> adjustments, because WaitFor and Free don't work anymore, of course) but
> there's no change.
>
> For sake of completeness, I made the same with my test program, where I
> can terminate, free and restart the thread multiple times, and I see the
> memory usage increasing each time: it started with 12Kb

You mean 12mb, right?

> and I stopped
> when it had become 122Mb! However all memory is released before closing
> the program, because heaptrc correctly reports an increasing number of
> blocks allocated and freed, as a function of the number of times I
> started my thread.

I don't think heaptrc detects RTL associated OS leaks.  It only detects RTL 
object leaks, and it seems those are freed correctly.

> As soon as I can, I'd like to perform the same tests with Kylix, to see
> if it makes a difference.


Thanks a lot!

--
Al

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to