Linux binch-laptop 2.6.17-10-generic #2 SMP Fri Oct 13 18:45:35 UTC 2006
GNU C Library development release version 2.4, by Roland McGrath et al.
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
Compiled by GNU CC version 4.1.2 20060928 (prerelease) (Ubuntu
Compiled on a Linux 2.6.17-10 system on 2007-01-24.
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
GNU libio by Per Bothner
NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Native POSIX Threads Library by Ulrich Drepper et al
Thread-local storage support included.
For bug reporting instructions, please see:
List program below:
for (i = 0;i < 1024;i ++)
if (pthread_create(&my_thread, NULL, &thread_proc, NULL) != 0)
printf("pthread create error.\n");
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.