[Win32][VM] CreateThread() failures

Raab, Andreas Andreas.Raab at disney.com
Mon Feb 26 03:23:48 UTC 2001


Andreas,

> The CreateThread() calls in the Win32 VM sources use a 
> dwStackSize of 0. According to the appended CreateThread() 
> documentation-fragments this seems to be pretty expensive.

It's not too expensive (usually the Squeak stack is rather small).

> This might explain the "CreateThread() failed (8) -- Not 
> enough storage is available to process this command." problem.

Nope. It doesn't. I tried it and it didn't change a thing. However, reading
the documentation more carefully points out that:

> The number of threads a process can create is limited by the available
> virtual memory. By default, every thread has one megabyte of 
> stack space. Therefore, you can create at most 2028 threads.

"By default" reads as in "by default of your linker". If you do a quickview
on Squeak.exe you'll find that the GCC linker doesn't give one megabyte as
stack size. It gives "by default" 32MB (!!!) of stack size. Attempting to
allocate this for each and every thread leads to a tiny bit of a problem as
one might guess ;-)

Unfortunately, there seems to be a bit more going on. When I reduced the
stack size to approx. 128k I could open about 150 sockets at the same time
(which accounts for roughly 300 threads). A lot better. But when I reached
that limit, I got those weird messages that I've seen every now and then
giving me error messages in the screen update (oops...)

I'll have to look at this but thanks for pointing me to the information.

Cheers,
  - Andreas





More information about the Squeak-dev mailing list