Memory leaks when using pthead_exit() to exit thread
I have a problem when use pthread_exit() to exit .My code is like this: { ... pthread_attr_t attr; iRetValue = pthread_attr_init(&attr); iRetValue = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); size_t nStackSize = 4 * 1024 * 1024; iRetValue = pthread_attr_setstacksize(&attr, nStackSize); while(condition) { ... int32 iSockId = cServSocket.accept(); if(iSockId < 0) { continue; } pthread_t tid; int32* pSockId = new int(iSockId); iRetValue = pthread_create(&tid, &attr, run_thread, (void*)pSockId); ... } ... pthread_attr_destroy(&attr); } void* run_thread(void* p) { int32 iSockId =