Python 2.6 still not giving memory back to the OS...

Christian Heimes lists at cheimes.de
Sat Aug 15 14:05:36 EDT 2009


Mark Dickinson wrote:
> and got the expected memory usage for my Python process, as
> displayed by top:  memory usage went up to nearly 1Gb after
> each assignment to b, then dropped down to 19 Mb or so after
> each 'del b'.  I get similar results under Python 2.5.

I get the same results on Linux:

Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, psutil
>>> pi = psutil.Process(os.getpid())
>>> [mem/1024.**2 for mem in pi.get_memory_info()]
[4.71875, 28.2578125]
>>> s = 'x' * (10**9)
>>> [mem/1024.**2 for mem in pi.get_memory_info()]
[958.40234375, 981.93359375]
>>> del s
>>> [mem/1024.**2 for mem in pi.get_memory_info()]
[11.62890625, 55.1875]

Christian



More information about the Python-list mailing list