In the last episode (May 20), Peter Steele said: > I create a thread using something like this: > > pthread_t thread; > pthread_create(&thread, NULL, mythread, NULL); > pthread_detach(thread); > > I use the detach because I want to make sure the thread's resource are > reclaimed when the thread completes. However, this does not seem to work. > Each time I create a thread the application's memory footprint grows by > 128 bytes and this memory is never released.
Are you malloc'ing some data in your thread and not freeing it before exiting? pthread_detach simply lets the system discard the thread when it exits instead of preserving the return code (for pthread_join to retrieve). It isn't responsible for freeing all memory allocated by the thread, and it shouldn't, since one thread may allocate memory that another thread frees later. -- Dan Nelson dnel...@allantgroup.com _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"