Pthread_create memory usage (pthread BUG?)

Jakub Jelinek jakub@redhat.com
Fri Mar 2 12:35:00 GMT 2007


On Fri, Mar 02, 2007 at 07:18:56PM +0800, Bin Chen wrote:
> I wrote a simple program that spawn a lot of threads using pthread, 
> after ran the program the memory usage of the process increase very 
> fast, soon it become:
> 
> cat /proc/5243/status abcde.

You are using default thread stack sizes, which is derived from ulimit -s
value, typically around 8MB or 10MB.  So if you create 1024 threads, that
would need 10GB of *virtual* memory.  There are several ways how you can
decrease the thread stack size, you can google around to find it out
or just look at man pages, this list is certainly not the right place
for such questions.

	Jakub



More information about the Libc-alpha mailing list