MemoryError for large sourcecode

Gerson Kurz gerson.kurz at t-online.de
Sun Oct 6 13:26:32 EDT 2002


I have a generated an atypical sourcefile that is about 4.278.351
bytes long (151.308 lines). When I try to import it, I get this:

C:\>python
ActivePython 2.2.1 Build 222 (ActiveState Corp.) based on
Python 2.2.1 (#34, Apr 15 2002, 09:51:39) [MSC 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import waytoomuch
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
MemoryError
>>>

I see that the memory usage goes up to about 128 mb, then the
exception is raised and memory drops back to 6 mb. My machine has 1 gb
of ram, with 589 m free, and 2.9 gb available virtual memory.
(OS=win2000_sp3). Are there any builtin limits to the size of a python
source or what is going on here? Bug report, anyone?

(And, yes, I know there are better ways than generating a 4.278.351
bytes sourcefile - it was just a quick hack).





More information about the Python-list mailing list