Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
- From: "Bill" <billme@xxxxxxxxxxx>
- Date: Fri, 5 Aug 2005 17:07:49 -0700
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: Gary
- Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
- From: Pavel Lebedinsky [MSFT]
- Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
- References:
- Prev by Date: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
- Next by Date: Re: Debugging AL code with VisualStudio 7
- Previous by thread: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
- Next by thread: Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
- Index(es):
Relevant Pages
|
Loading