Memory deallocation

spam at uce.gov spam at uce.gov
Mon Oct 19 17:50:09 CEST 2009


Steven D'Aprano wrote:
> On Mon, 19 Oct 2009 00:30:30 -0700, dheeraj wrote:
> 
>> Hi, a program of mine is being terminated by the OS as it uses too much
>> memory. I guess this is due to static memory allocation
>>
>> I've also tried to use "del" but in vain. Is there any other function
>> that performs the above operation and frees the allocated memory??

del is what you should use. You won't see memory reduction for that process, 
  but the memory will be available for other other objects and prevent a 
growth of the memory footprint for that process.


> 
> I would expect in general that Python will fail with a MemoryError 
> exception before the operating system terminates the process for using 
> too much memory. What are you doing in your program? What version of 
> Python are you using and what OS? You need to give more information for 
> us to be more helpful.

I have seen cases with large dictionaries of large-ish objects where the 
machine ends up trashing.

-- 
Yves.
http://www.sollers.ca/



More information about the Python-list mailing list