Subj : Re: CRT _beginthread returns -1, errno=ENOMEM "Not enough space" on 3GB dualcpu To : comp.programming.threads,comp.os.ms-windows.programmer.nt.kernel-mode,microsoft.public.vc.language From : lpdcunha Date : Thu Mar 31 2005 01:45 pm > >_beginthread() returns (-1L). I have this: > > > > thr = _beginthread( (void (*)(void *) )f, stk_size, (void *)arg ); > > > >Error code I get is: > > 1) errno = 12, ENOMEM "Not enough space" > > 2) GetLastError() returns 8, ERROR_NOT_ENOUGH_MEMORY > > "Not enough storage is available to process this command." > > > > stk_size passed in 32768 for both threads. > > MSDN mentions that any thread using the C runtime requires at least a > 64KB stack. I think this is a more likely problem in your case than > running out of virtual address space, which you can check using > Process Explorer from http://www.sysinternals.com, or the memory tools > available from http://www.softwareverify.com. Thanks but I could not find the docs describing this limitation. I'll keep looking. > >p.s. Aside: I had some CRT-debug problems. I linked msvcrtd.dll > >debug-multithreaded CRT into the app. But I could not successfully > >step into the code for _beginthread() in thread.c CRT-source file. The > >symbols were not found (even though I have msvcrtd.pdb in the path) > >These files are all in my VC98 subdirectories. Oh well. > > Look up the MS symbol server in MSDN. It will keep your symbols > up-to-date for all your system DLLs. You set your symbol path to a > special string which downloads symbols for system DLLs automatically > as needed, and updates them after service packs, updates, patches, > etc. Ok, I'll give this a try. Am downloading the symbols package now. Thanks, Larry .