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

Peter Otten __peter__ at web.de
Mon Aug 27 12:06:16 EDT 2007


Peter Otten wrote:

> Alex Martelli wrote:
> 
>> Integer objects that are once generated are kept around in a "free list"
>> against the probability that they might be needed again in the future (a
> 
> Python 2.5.1 (r251:54863, May  2 2007, 16:56:35)
> [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> x = 1000
>>>> y = 1000
>>>> x is y
> False
> 
> Why don't x and y point to the same object then?
> 
> Peter

Oops, I think I got it now. The actual objects are freed, only the memory is
kept around for reuse with other ints...

Peter



More information about the Python-list mailing list