【发布时间】:2010-09-13 05:20:44
【问题描述】:
假设我有以下代码:
while(TRUE) {
pthread_t *thread = (pthread_t *) malloc(sizeof(pthread_t));
pthread_create(thread, NULL, someFunction, someArgument);
pthread_detach(*thread);
sleep(10);
}
分离的线程会释放 malloc 分配的内存,还是我现在必须做的事情?
【问题讨论】:
标签: c multithreading memory-management malloc pthreads