[Python-Dev] [ python-Patches-876206 ] scary frame speed hacks
Armin Rigo
arigo at tunes.org
Wed Mar 3 11:22:35 EST 2004
Hello Michael,
On Tue, Mar 02, 2004 at 05:26:56PM +0000, Michael Hudson wrote:
> But list_sort pushes quite a large object onto the stack. So if you
> arrange for that too appear on the stack repeatedly, you get a crash
> much earlier.
>
> Python's recursion limit is a nasty hack. Unfortunately, all the
> alternatives are worse :-( (except some variant of stackless, I guess,
> but that probably doesn't help the list_sort business).
What about limiting the byte size of the C stack, instead of the recursion
level? You can estimate the current size of the stack in a C program fairly
easily (although it is a clear hack, I expect it to work on any platform): get
the difference between a pointer to some local variable and a (previously
saved) pointer to a local variable in some C frame near the bottom.
Armin
More information about the Python-Dev
mailing list