MemoryError for large sourcecode

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


As a followup, you can use this code to generate a testfile that fails
on my machine with MemoryError:

t = open("huge.py","w")
print >>t, "B = {}"
for i in range(50000):
    print >>t, "B[%d]=[0]*10" % (i)
t.close()    
    
The maximum ever allocated by python.exe is around 80m in this case.
The following allocation works fine:

onemeg = 1024*1024
bigchunk = "*" * onemeg * 800

and allocates 800 m, and

del bigchunk

frees it again...




More information about the Python-list mailing list