Garbage collection working improperly?

Andrew Bennetts andrew-pythonlist at puzzling.org
Fri Nov 21 16:47:20 CET 2003


On Fri, Nov 21, 2003 at 11:58:24AM +0100, Oliver Walczak wrote:
> Dear List,
> Trying the following hack:
> 
> >>> a = []
> >>> for i in range(0,9999999):
> 		a.append(i)
> >>> del(a)
> 
> Builds up a great list in memory and immediately deletes it. Unfortunately
> the task manager shows me that i allocated about 155MB in memory before
> del(), but del only releases about 40MB of them so i'm leaving about 117 MB
> of reserved memory after deleting the list.

I believe space allocated for integers is never freed, it is instead added
to a free-list.  So long as you never have a ridiculous number of integers
alive simultaneously, it's not a significant problem... 

-Andrew.






More information about the Python-list mailing list