title: My app mem usage is growing using pthread
body: <p>I am using C language and Linux as my programming platform.</p>
  
  <p>In my user-space application. I used pthread to create a thread.</p>
  
  <pre><code>int main()
  {
     pthread_t thread1, thread2;
     pthread_create( &amp;thread1, NULL, fthread1, NULL );
     pthread_create( &amp;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 );
  }
  </code></pre>
  
  <p>My problem is when I loop pthread_create to create again the two thread, my application memory usage is getting bigger. </p>
  
  <pre><code>while( 1 )
  {
     pthread_create( &amp;thread1, NULL, fthread1, NULL);
     pthread_create( &amp;thread2, NULL, fthread2, NULL);
  }
  </code></pre>
  
  <p>I determine the memory usaage using Linux ps command-line tool in VSZ column.</p>
  
  <p>It seems I missed some part using pthreads API. How can I make my app don't use too much memory.</p>