Freeing memory from Python lists!

Mike Simpson msimpson at ioindustries.com
Thu Jul 12 14:32:52 CEST 2001


chat at linuxsupreme.homeip.net (Chad Everett) wrote in message news:<slrn9kpj0n.mi0.chat at linuxsupreme.homeip.net>...

Thanks for the helpful response Chad!


Mike


> Nothing has been lost.  As other responses have pointed out, you are seeing
> a manifestation of the OS memory management algorithms.  To show you that
> nothing has been "lost" do the following:
> 
> 1. run python and get a python prompt
> 
> 2. look at your memory allocation
> 
> 3. do your:
> 
> result = []
> for count in xrange(510*478):
>       result.append(count)
> 
> 4. look at memory usage
> 
> 5. delete the result list
> 
> del result
> 
> 6. look at memory usage
> 
> 7. now build the list again
> 
> result = []
> for count in xrange(510*478):
>       result.append(count)
> 
> 8. look at memory usage and you'll see it has only gone back up to the same 
>    amount of memory at step 4.
> 
> 
> 
> 
> 
> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



More information about the Python-list mailing list