need help checking for stack overflow in Win32
tismer at appliedbiometrics.com
Thu Jun 3 07:09:45 EDT 1999
Mark Hammond wrote:
> Christian Tismer wrote in message
> <375502C7.39C4FD0E at appliedbiometrics.com>...
> >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.
The shorthand solution is to either modify the stack size
of the program, or to modify the recursion depth in
The better solution is stackless Python which I'm
working on. But I'm no sourcerer, it takes time.
> >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?
No. People who build from sources migtht simply change
their stack size or the recursion depth parameter.
There is no reason to submit such a patch to Guido,
since he can adjust his parameters alone.
The reason why I provided a binary patch is, that this
problem is not worth messing around with another python release.
If someone cares, he just adjusts his max_recursion_depth
with my little program, and he's done.
This is even more powerful than changing the source,
since this parameter can be patched whenever needed,
Of course, such a parameter could be made visible and
changeable through a variable like sys.max_recursion,
but this is a change which Guido would not want to
include into 1.5.2 .
So well, my patch does it. Many people don't like
binary patches. I don't care, it works and it's there.
> You have provided an excellent interim fix, but IMO the problem remains.
The interim fix is the final fix, since the problem is
about to vanish completely.
ciao - chris.stackless
Christian Tismer :^) <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101 : *Starship* http://starship.python.net
10553 Berlin : PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
we're tired of banana software - shipped green, ripens at home
More information about the Python-list