Python stack problems (?)

jcbphi

Registered
I've been playing around with Python for the first time recently, and have been running into some odd problems involving recursion. Specifically, I've been writing some sorting algorithms for a class (me = CS student), at least one of which sometimes involves heavy recursion (>4192 recursive calls). Whenever I run one of these, it runs for a little while, then dumps the stack with the error:

RuntimeError: maximum recursion depth exceeded

I seem to be able to make a little over 500 recursions before everything blows up. This seems like a really low limit. My first thought was to blame it on Python itself, but when I went to run the same script on a Linux machine (running Python 1.5.2), it worked perfectly. The problem seems to only crop up when its running on my OS X 10.1 machine. I'm currently running Python 2.1.1. I imagine that for some reason Python is using a smaller stack than I'd like it too. Has anybody else run into this problem?

Any help on this would be appreciated....thanks in advance.
 
Standard stack limit on OS X is 512K; max seems to be 64M.

use limit or ulimit to increase the stack (refer to the manual of your favorite shell, (u)limit is a builtin)
 
Back
Top