CreateThread Not enough storage is available to process this command

Hi,

My app has like 60 threads it crashes randomly because of this. I debugged each one and it crash at random thread to make it worst.
The error code is the same not enough storage space blahblah (error code 8).

Even tho the app's memory usage does not jump at all.

I read some other answers that it can be because terminatethread is not stable, what I use at certain places.

Anyone who has a decent windows programming experience and ran into this problem please help.

Last edited on
did u try it without terminatethread?... try to insert flags for the threads that they check for during a cycle... so if they need to become deleted... they end themselves and cleanup properly...
Hi,

I can't just remove the terminatethreads, its in it for a reason.
All of my threads set to quit properly with ExitThread(0);
But to explain a bit more what happens in my program:

function -> spawn [n] threads
thread1 -> call external function -> start thread 1A
-> start watchguard thread for 1A
...

So if thread 1A would stuck in execution the watchguard thread uses terminatethread to kill it, the execution time of 1A. It's complicated explaining why don't I use the timeout in waitforsingleobject to terminate 1A but would that termination be different than terminatethread?

Topic archived. No new replies allowed.