> There's a disconnect here. handles aren't process
> identifiers: they're reference counted "pointers" to the
> kernel structures for the process. If you are holding a
> handle (ie: from CreateProcess or OpenProcess) that handle
> cannot and will not be reclaimed until you call CloseHandle
> (or your process itself exits). You should never retain a
> handle after you've called CloseHandle on it.
>
> Which brings an interesting thought: are process ID's
> reclaimed while open handles remain? I'm willing to bet the
> answer is no. In that case, the stats collector could retain
> the handle until it's done with the process ID.
Since the process id lives in the kernel structure they point to, they
can't very well be recycled... (classical
handle-leak-kills-windows-system-by-running-out-of-kernel-space
scenario).
The problem is, the stats collector doesn't have the handle in the first
place. I guess it could open one upon receiving the bestart message, but
it seems like a kludge. Would be nicer if it could be done cleaner :-)
//Magnus