How to free memory ( ie garbage collect) at run time with Python 2.5.1(windows)

rfv-370 robert.vergnes at yahoo.fr
Mon Aug 27 10:18:26 EDT 2007


have made the following small test:

Before starting my test my UsedPhysicalMemory(PF): 555Mb

>>>tf=range(0,10000000)    PF: 710Mb ( so 155Mb for my List)
>>> tf=[0,1,2,3,4,5]             PF: 672Mb (Why? Why the remaining 117Mb is not freed?)
>>> del tf                            PF: 672Mb (unused memory not freed)

So changing the list contents and/or deleting the list changes
nothing...from a memory point of view.

This is a problem as I have several applications/threads competing for
memory share. (ie wxpython app).

So how can I force Python to clean the memory and free the memory that
is not used?


PS: gc.collect() does nothing - To return memory I need to kill my
process (ie the interpreter).

Any ideas is welcome.

Thanx

Robert




More information about the Python-list mailing list