Freeing memory from Python lists!

Mike Simpson msimpson at
Wed Jul 11 14:41:25 EDT 2001

I can't figure out how to free the memory used in the creation of a
large list in Python.
I am running the Python 2.1 interpreter on Windows 2000 Professional
to run the following piece of code:

result = []
for count in xrange(510*478):
del result

By using Windows Task Manager I was able to determine that 4332K of
memory was used up until the end of the for loop, but only 960K of
memory was returned to the system after the call to "del".  Is there
any way to return the other 3372K of memory to the system without
quitting the Python interpreter?

Any help would be greatly appreciated.


More information about the Python-list mailing list