Garbage collection
Tom Wright
tew24 at spam.ac.uk
Wed Mar 21 09:13:29 EDT 2007
Hi all
I suspect I may be missing something vital here, but Python's garbage
collection doesn't seem to work as I expect it to. Here's a small test
program which shows the problem on python 2.4 and 2.5:
$ python2.5
Python 2.5 (release25-maint, Dec 9 2006, 15:33:01)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
(at this point, Python is using 15MB)
>>> a = range(int(1e7))
>>>
(at this point, Python is using 327MB)
>>> a = None
>>>
(at this point, Python is using 251MB)
>>> import gc
>>> gc.collect()
0
>>>
(at this point, Python is using 252MB)
Is there something I've forgotten to do? Why is Python still using such a
lot of memory?
Thanks!
--
I'm at CAMbridge, not SPAMbridge
More information about the Python-list
mailing list