Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
- From: Gary <debugger@xxxxxxxxxxxxxxxx>
- Date: Sat, 06 Aug 2005 12:59:52 +0530
Well, the stack size manipulation is not acceptable for us. This application was running fine until few days back but it started popping up this error after we had a new drop of binaries.
The system WIN2K Server has almost 4G RAM available & huge disk space. I dont think its running out of system memory.
Do you think the pagefile settings of the box needs to be re-looked ?
Apart from looking into the number of different kind of objects consumed......Is there any way to see if any of those object types is hitting a maximum limit ?
Thanks, Gary.
Bill wrote:
Reduce the "stack size" parameter you are using with CreateThread() -- each thread gets 1MB by default, but you probably do not need that much. That will allow you to run more threads.
Also, your problem is not that you are running out of addressable user-memory, which is what the /3G switch does -- you are running out of system memory. Using the /3G switch will actually reduce the number of threads / handles / resources available. If you reduce the stack-size per thread, you will get more threads, up to when the operating system runs out of space for its internal tables. Then, if you remove the /3G switch, you will be able to get more threads, because the operating system will have another 1GB of space for its internal tables.
There are other limits (total number of HANDLEs, total number of GDI objects), so depending on what is happening in your threads, you may be hitting one of these limits.
Use the Task Manager / Processes / View / Select Columns / USER Objects, GDI Objects, Paged Pool, and also on the Performance tab Kernel Memory.
Hope this helps.
Specify a smaller stack size "Gary" <debugger@xxxxxxxxxxxxxxxx> wrote in message news:oqRIe.24$XP5.102@xxxxxxxxxxxxxxxxxx
Hello Experts, In our application we see CreateThread Failing with ERROR_NOT_ENOUGH_MEMORY. In the failing state, the app has almost 180 threads & the process VM has shoot upto 1.9GB ( noted via Process Explorer ). We used /3G switch in boot.ini & then rebooted the system & re-ran the app but then also we see the same error & the VMsize being the same.....around 1.8G. This is quite surprising since now the process can grow upto 3G theoritically ( & practically too ) . What can go wrong over here ?
Any pointers would be very helpful since this is a very time critical issue for us. Any kind of tracing or something that we can do, to pin it down ??? Also, let me know if you need any other info to comment on this.
Thanks, Gary.
.
- Follow-Ups:
- Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
- From: Arnaud Debaene
- Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
- References:
- Prev by Date: Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
- Next by Date: Re: Mixing compiler managed thread-local-storage with the TLS API's
- Previous by thread: Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
- Next by thread: Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
- Index(es):
Relevant Pages
|
Loading