[SciPy-user] How to free unused memory by Python
Mon Aug 27 11:49:41 CDT 2007
Robert VERGNES wrote:
> This is not a scipy issue - albeit I do use scipy for my app- and that
> array() creation seems to crash once I reached my upper Physical Memory
> The question is general, How to free unused memory by Python:
> Te following small test demonstrates the issue:
> Before starting the 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 ( Nothing happens)
> So changing the list contents and/or deleting the list changes nothing...
> This is a problem as I have several applications/threads competing for
> memory share.
> So how can I force Python to clean the memory and free the memory that
> is not used?
Pythons previous to 2.5 do not release memory back to the OS even after all of
your objects have been completely decrefed.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the SciPy-user