execfile eats memory

jepler at unpythonic.net jepler at unpythonic.net
Mon Sep 19 21:34:06 CEST 2005

I generated a ~22-megabyte file with this small Python program:
	print "["
	for i in xrange(2000000):
	    print "'" + str(i) + "', "
	print "]"

As the original poster suggested, Python uses at least several hundreds
of megabytes when execfile()ing that source.  I had to kill the program
before it exited because it brought my computer (1GB RAM) to a standstill.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050919/de6e07ee/attachment.pgp>

More information about the Python-list mailing list