Contents

Any thread that has terminated but has not been joined or detached will leak OS resources until the process terminates. Unfortunately, neither /proc nor gdb will show you these zombie threads, at least not on some kernels.

One way to get them is with a gdb canned command:

###
define trace_call
b $arg0
commands
bt full
continue
end
end
document trace_call
Trace specified call with call stack to screen. Example:
set breakpoint pending on
set pagination off
set logging on
trace_call __pthread_create_2_1
end