Memory leaks in pthread even if the state is detached
问题 I am learning pthreads programming. I understood that there are two states of thread: 1. Joinable 2. Detachable In case of Joinable, we need to call pthread_join to free the resources(stack), whereas in case of detached there is no need to call pthread_join and the resources will be freed on thread exit. I wrote a sample program to observe the behavior #include <stdio.h> #include <pthread.h> #include <stdlib.h> void *threadFn(void *arg) { pthread_detach(pthread_self()); sleep(1); printf(