This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Pthread_create memory usage (pthread BUG?)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Bin Chen <binary dot chen at gmail dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 2 Mar 2007 13:38:12 +0100
- Subject: Re: Pthread_create memory usage (pthread BUG?)
- References: <45E80820.5010100@gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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