Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>When you say <code>So, actually process holds 5766 threads.</code>, what you really mean is that the process holds 5766 <em>thread handles</em>.</p> <p>Even though a thread may no longer be running, whether that is the result of a call to <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms682659%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>ExitThread()</code></a>/<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms686717%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>TerminateThread()</code></a> or returning from the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms686736%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>ThreadProc</code></a>, any handles to that thread will remain valid. This makes it possible to do things like call <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms683190%28v=vs.85%29.aspx" rel="nofollow noreferrer">GetExitCodeThread()</a> on the handle of a thread that has finished its work.</p> <p>Unfortunately, that means that you have to <a href="https://stackoverflow.com/questions/3959473/must-i-closehandle-on-a-thread-handle">remember to call <code>CloseHandle()</code></a> instead of just letting it leak. The MSDN example on <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms682516%28v=vs.85%29.aspx" rel="nofollow noreferrer">Creating Threads</a> covers this to some extent.</p> <p>Another thing that I will note is that somewhere not too far above 1000 running threads, you are likely to <a href="https://blogs.msdn.com/b/oldnewthing/archive/2005/07/29/444912.aspx?Redirected=true" rel="nofollow noreferrer">exhaust the amount of virtual address space available</a> to a 32bit process since each thread by default reserves 1MB of address space for its stack.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload