Suppose I have the following code:
while(TRUE) {
pthread_t *thread = (pthread_t *) malloc(sizeof(pthread_t));
pthread_create(thread, NULL, someFunction, someArgument);
pthread_detach(*thread);
sleep(10);
}
Will the detached thread free the memory allocated by malloc, or is that something I now have to do?