How to avoid MemoryError on recursion?
Dave Haynes
Dave.Haynes at sia-mce.co.uk
Thu Jun 28 07:05:58 EDT 2001
Hi all,
I'm using John Aycock's SPARK (
http://www.csr.uvic.ca/~aycock/python/ ) to process some files. Part
of the SPARK semantic checker uses a recursive function to traverse
the syntax tree. I've had to increase the recursion limit to 10000 to
avoid RuntimeError, and I now get 'MemoryError: Stack overflow'.
Is there anything I can do to get Python more allocated memory (or
get it to use less)? I'm using Python 2.0 on a Windows NT4 box with
256 Mbyte RAM. Task Manager registers only 26% of this in use while
running the script.
Anyone more familiar with SPARK than I am might be able to give some
tips on how to flatten the AST tree. I'm working from a fixed BNF
description, which has plenty of hierarchy in it.
Cheers,
Dave.
More information about the Python-list
mailing list