Why deleting large variables doesn't free up any memory?
Aahz
aahz at pythoncraft.com
Fri Apr 4 13:02:37 EST 2003
In article <169a7283.0304040936.69e2b9a1 at posting.google.com>,
sdieselil <sdieselil at yahoo.com> 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?
That's got nothing to do with Python; generally speaking, once the OS
allocates memory to a process, the process keeps it until it exits.
However, if you allocate and de-allocate big chunks of memory, you'll
notice that Python's size stays static -- the memory gets re-used.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
This is Python. We don't care much about theory, except where it intersects
with useful practice. --Aahz, c.l.py, 2/4/2002
More information about the Python-list
mailing list