[fpc-pascal] Re: Multi-threaded project with few locks (no Thread.waitfor). Memory consumption keeps increasing on Ubuntu 10.10 x64

Michael Van Canneyt michael at freepascal.org
Wed Oct 13 15:28:38 CEST 2010



On Wed, 13 Oct 2010, Andrew Brunner wrote:

> On Tue, Oct 12, 2010 at 5:51 PM, Andrew Brunner
> <andrew.t.brunner at gmail.com> wrote:
>
> Another problem demonstrated with this application is the limiting
> factor of thread creation.  I'd like to make a complaint using this
> code as well.  Change the number of threads to 3000.  The system gets
> to about 1,000 and starts to "bog down".  I have a significantly fast
> computer here and I can tell that thread creation is not supposed to
> be this slow.
>
> Under delphi 2006 (windows) I was able to create up to 3000 threads.
> I recall stories of other programs in Java running well past that
> 3000.  Why does fpc handle threads in a way that causes creation to
> slow down the more you have (as they approach 1,000) things slow to a
> stall.

Probably because it uses a heap manager per thread.

You may try to use 'cmem', which will replace the heap manager with the C
memory manager (one for the whole app, not per thread). That will allow you
to test this hypothesis.

Michael.



More information about the fpc-pascal mailing list