Why deleting large variables doesn't free up any memory?

Nick Hilliard nick at foobar#delete2email#.org
Sat Apr 5 06:42:20 EST 2003


sdieselil wrote:

> I'm using Python 2.2.2 under FreeBSD. When I create a large variable
> (using for example "a = range(1000000)") 'top' command indicates that
> Python ate 12MB of swap space. But when I execute "del a" nothing
> happens, it doesn't release these 12MB! Using "gc.collect()" also
> doesn't help. What's the problem? What happened to Python's garbage
> collector?

Regardless of the other answers in this thread, I suspect that this problem is 
probably less important than you think.  If FreeBSD thinks that the memory isn't 
being used, it will be swapped out if there's a memory shortfall at any stage. 
The important factor is amount of memory which is being actively used at a 
particular time.

Nick





More information about the Python-list mailing list