Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



60K handles is certainly not normal and is most likely a leak.
You can use !handle and !htrace in windbg/cdb to debug this.

That said, I still think that your CreateThread failures are probably
caused by running out of per-process address space. The handle
leak may or may not be part of the same problem; there's no way
to tell in advance. Some handle leaks also involve leaking
significant amounts of user mode memory while others don't.
60K handles is a lot but is certainly not even close to the theoretical
limit. For example if you duplicate the same handle again and
again you could probably create millions of them.

Anyways, this is all just guessing. We need more info to make
progress. Can you post the output of '!heap 0' and '!handle 0 0' ?

--
This posting is provided "AS IS" with no warranties, and confers no
rights.

"Gary" wrote:

> We did some rough calculation & found that.....given the amt. of mem
> consumed by each thread.....the process will easily consume all of 2G & we
> can run out of all 2G of Virtual memory.
> Hence we came down on the number of clients connecting to our appln &
> found that the test ran for almost 50 hrs before it failed in CreateThread
> again.
> This time the VM is close to 2G but the number of handles is just more
> that 60K.
> I am just wondering...if there is a handle leak issue involved , can it
> prevent a thread from getting created & some point down the line ???
> Are we reaching the max num of handles that a process can open on Win2k
> Server SP4 ?? Is there a limit on that ??? How does the increase in num of
> handles effects the net process VM ?


.