how to explain this memory usage

Remco Gerlich scarblac at pino.selwerd.nl
Thu Apr 26 10:34:48 EDT 2001


javalist <javalist at 21cn.com> wrote in comp.lang.python:
> Hello python-list,
> 
>         in the python 2.0 interpreter,I write some code to make the interpreter
>         allocate more than 20M memory,and then I del all the object that I
>         create,but python still using that 20M memory,I try import gc,and then
>         use gc.collect,no good.python has 20M in memory still.
>         also the interpreter has 20M in memory,but seems python knows they are
>         pointing nothing and reuse these 20M when I try again allocating more
>         object in python,it didn't increase memory until the first 20M is
>         occupied by the new allocated object

Python can free the memory, but that doesn't mean it's available for another
program then. On some operating systems (Windows) it simply means that this
program can re-use the memory. So programs don't grow smaller, only bigger. 

Not a Python issue, anyway. Simply the way the OS does it.

-- 
Remco Gerlich



More information about the Python-list mailing list