[osg-users] [patch] PThread.c++ creation error, lower stack size limit

Cedric Pinson cedric.pinson at plopbyte.net
Sun Nov 29 07:21:14 PST 2009

Hi David,

I had a weird issue, i think it's related to thread but dont know if
it's because of the submission. I use a lot of threads not at the same
time but on a long period. It seams the thread i create are not remove
from memory, so at the end of day i have 3Gb of virtual memory used.
Doing a memory map i can see a lot of memory entry with 8MB and at a
given time my program stop to create thread (from a limit i guess).
I did not dig enough yet to tell more, but if some of you have an idea
or suggestion i will take them.


+33 659 598 614  Cedric Pinson mailto:cedric.pinson at plopbyte.net

On Fri, 2009-10-16 at 08:31 -0500, David Fries wrote:
> This was against 2.8.1, but I see the trunk is identical.
> Any issues with using PTHREAD_STACK_MIN?
> http://www.opengroup.org/onlinepubs/9699919799/functions/pthread_attr_getstacksize.html
> I was trying to create a lot of threads under 32 bit Linux, but could
> only create 376, then the program would hang.
> 376 * 8MB stack per thread = 3008 MB
> The stack size allocated per thread blew the process address stack.
> To get more threads you have to specify a smaller per thread stack,
> but while the Thread::start says it will limit the stack size to the
> smallest allowable stack size, it won't let it be smaller than the
> default.  I included the limits.h header to use PTHREAD_STACK_MIN as
> the minimum stack size.
> As for the deadlock, if the pthread_create failed, the new thread
> doesn't exist and doesn't call threadStartedBlock.release(), so the
> existing thread deadlocks on threadStartedBlock.block().  Only block
> if the thread was started.
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20091129/eb2633aa/attachment.pgp>

More information about the osg-users mailing list