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);


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

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

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 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.

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

Regards,

Giuliano

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

Reply via email to