Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....



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....
    ... I dont think its running out of system memory. ... Using the /3G switch will actually reduce the number of ... There are other limits (total number of HANDLEs, ... the app has almost 180 threads & the process VM has shoot upto 1.9GB. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
    ... "Bill" wrote: ... > system memory. ... Then, if you remove the /3G switch, you ... > will be able to get more threads, because the operating system will have ...
    (microsoft.public.win32.programmer.kernel)
  • Re: CreateThread Fails with ERROR_NOT_ENOUGH_MEMORY....
    ... Pavel Lebedinsky wrote: ... system memory. ... thread, you will get more threads, up to when the operating system runs out ... Then, if you remove the /3G switch, you ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Fw: Fw: IMS at the Crossroads?
    ... This switch was in the OS, ... I know of no other operating system that provides this ... the same install of those operating system levels ... the only part of DB2 that uses IMS like access is in the original ...
    (bit.listserv.ibm-main)
  • 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)

Loading