This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
simple pthread consumes memory
- From: balazs <balazs___ at freemail dot hu>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 22 Sep 2006 15:51:20 -0700 (PDT)
- Subject: simple pthread consumes memory
Hi - I start a simple pthread and the program consumes about 10 Mbytes of
virtual memory. If I start 10 threads, it consumes 100 Mbytes. I don't know
why this is happening to me. I tried it on two Debian and a 64 bit Ubuntu
machines and the same thing happened to me. Thanks in advance for any help.
Balazs
I compile by: g++ -lpthread main.cpp
#include <pthread.h>
void* myfunction( void* ptr ) {
int sum = 0;
for( int i = 0; i < 2000000000; i++ )
sum *= i;
}
int main( int argc, char* argv[] ) {
pthread_t mythread;
pthread_create( &mythread, 0, &myfunction, NULL );
pthread_join( mythread, NULL );
}
--
View this message in context: http://www.nabble.com/simple-pthread-consumes-memory-tf2320485.html#a6456330
Sent from the gcc - Dev mailing list archive at Nabble.com.