Я сталкиваюсь с ситуацией, когда потоки, которые я создаю отделяемыми, не освобождают свою память после того, как они вышли.
Я попытался создать потоки следующими способами
1-
pthread_attr_setdetachstate(&pthread_attributes, PTHREAD_CREATE_DETACHED);
pthread_create(&thread_id, &pthread_attributes, establish_connection,
(void *) establish_connection_arguments);
2-
pthread_create(&thread_id, &pthread_attributes, establish_connection,
(void *) establish_connection_arguments);
pthread_detach(thread_id);
3-
pthread_create(&thread_id, &pthread_attributes, establish_connection,
(void *) establish_connection_arguments);
void *establish_connection(void *arguments) {
pthread_detach(pthread_self());
return NULL;
}
Я уверен, что память все еще сохраняется,как pmap подтверждает это.
Это нормальное поведение, что pmap будет по-прежнему показывать потоки с их памятью после завершения потоков?