Thanks - I manually adjusted my ulimit for that, and it did seem to fix/mitigate the problem. I'll look into using setrlimit() to do it in the future :).
-DMZ On Fri, 2006-01-27 at 11:26 -0500, Rob wrote: > On Fri, Jan 27, 2006 at 08:06:59AM -0500, David Zakar wrote: > > Is there a maximum number of threads I can spawn in a program using > > pthread_create() in Linux? I've noticed that once I exceed 300 or so, it > > appears to just refuse to create new threads. > > You need to shrink the max stack per thread with setrlimit(). Basically, > default max stack size is : > > [EMAIL PROTECTED]:~/swork/sidecar> limit stacksize > stacksize 10240 kbytes > > and the max number of threads, n, is such that n*10k is less than the > 2GB user space addressible space. Each thread doesn't use all of the > stack space at once (it dynamically grows with each thread), but it > ensures that the max is available before letting you create the thread. > > - Rob > . > >
