need help checking for stack overflow in Win32

Mark Hammond MHammond at
Wed Jun 2 08:35:41 EDT 1999

Christian Tismer wrote in message
<375502C7.39C4FD0E at>...

>Nope. The trap is:
>You compiled with VC++ 6.0 which has better register spilling.
>Therefore, recusion costs only 100 bytes, not 104.
>Not calculate 104 * 10000 and you see why 1 MB stack
>lets it crash.

Cool.  Thanks.

But doesnt the fact remain that counting the recursion depth is dangerous?
Im thinking of embedded environments, where a) the stack size of the hosting
.exe can't be known and b) the stack used by the app before Python is even
called can't be determined.  Add to this callbacks in GUI and COM type
applications, and we seem to be applying more band-aids.

The idea of counting space used seems better, but still assumes a known
stack size.

>I submitted a patch program for this kind of
>problems, so I think there is no need to change
>Python 1.5.2 at all.

Huh?  Are you suggesting people continue to build from sources, then run
your script to get an "official" version?  Wouldnt it be better to get Guido
to apply these changes to the build process?

You have provided an excellent interim fix, but IMO the problem remains.


More information about the Python-list mailing list