Just know if we call the pthread_create with default pthread_attr_t
, then Posix
will keep the exited thread information for other thread to query it, there is zombie thread leak if we didn't call pthread_join
.
But as I know, on Windows
platform, you doesn't need to call WaitForSingleObject
or GetExitCodeThread
after an thread existed.
So how Win32
handle zombie thread issue, will there resource leak?
On Windows, threads are kernel objects that are referenced from user mode by HANDLE
s. One property of a kernel object is that it "remains in memory as long as at least one object handle exists."
If you do not call CloseHandle
on your thread handle(s), you will leak the kernel object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With