Garbage collection working improperly?

Diez B. Roggisch deets.nospam at web.de
Fri Nov 21 06:29:45 EST 2003


Hi,

> Builds up a great list in memory and immediately deletes it. Unfortunately

if all you want is to create a loop, use xrange instead of range - it 
won't create that huge list.

> 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'm using python 2.2.3 on WinXP.
> Any ideas about that? How can i dealloc the left memory space?

Nope, no idea - the only thing that I can think of is that python not 
necessarily releaseses the memory because it uses its own allocation 
scheme. I don't know that for sure, but I definitely would go for such a 
thingy if I was to implement a virtual machine.
Its like in JAVA - each object instantiation and destruction isn't 
paired with system malloc/free calls, but some internal memory manager 
deals with that. And if it rans out of space, it will request more from 
the system.

Regards,

Diez





More information about the Python-list mailing list