Hi,
I am using C language and Linux as my programming platform.
In my user-space application. I used pthread to create a thread.
int main()
{
pthread_t thread1, thread2;
pthread_create( &thread1, NULL, fthread1, NULL );
pthread_create( &thread2, NULL, fthread2, NULL );
return 0;
}
void *fthread1( void *ptr )
{
/* do something here */
pthread_exit( NULL );
}
void *fthread2( void *ptr )
{
/* do something here */
pthread_exit( NULL );
}
My problem is when I loop pthread_create to create again the two thread, my application memory usage is getting bigger.
while( 1 )
{
pthread_create( &thread1, NULL, fthread1, NULL);
pthread_create( &thread2, NULL, fthread2, NULL);
}
I determine the memory usaage using Linux ps command-line tool in VSZ column.
It seems I missed some part using pthreads API. How can I make my app don't use too much memory.