Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....



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.



.



Relevant Pages

  • Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
    ... system memory. ... thread, you will get more threads, up to when the operating system runs out ... Then, if you remove the /3G switch, you ... There are other limits (total number of HANDLEs, ...
    (microsoft.public.win32.programmer.kernel)
  • Re: switch() Statement Question
    ... nested blocks, but it does not follow that you can successfully ... containing another similar switch, and so on down through 126 levels ... source code ...) ... the limits, and then rejecting all other source codes as "too big." ...
    (comp.lang.c)
  • Re: Why doesnt "switch" statement have "break" as default?
    ... The 'C' switch statement is in no way syntactic sugar for a cascade of if-else ... I do realise that the compiler and/or JIT is allowed to implement any ... As to the proposal to add lists and ranges, a couple of comments, not entirely ... and those limits would translate into apparently arbitrary (and very ...
    (comp.lang.java.programmer)
  • Re: landing weather
    ... landing, because showers popped up on the approach end of runway 33. ... crosswinds had increased past limits? ... It was nice to see how smoothly the runway heading switch was handled - does ...
    (sci.space.shuttle)

Loading