memory recycling/garbage collecting problem

David Niergarth jdnier at
Thu Feb 26 15:38:34 CET 2009

On Feb 16, 11:21 pm, Yuanxin Xi <xi11w... at> wrote:
> Could anyone please explain why this happens?  It seems some memory
> are not freed.

There is a "bug" in versions of Python prior to 2.5 where memory
really isn't released back to the OS. Python 2.5 contains a new object
allocator that is able to return memory to the operating system that
fixes this issue. Here's an explanation:

What version of Python are you using? I have a machine running several
long-running processes, each of which occasionally spike up to 500M
memory usage, although normally they only require about 25M. Prior to
2.5, those processes never released that memory back to the OS and I
would need to periodically restart them. With 2.5, this is no longer a
problem. I don't always see memory usage drop back down immediately
but the OS does recover the memory eventually. Make sure you use 2.5
if this is an issue for you.


More information about the Python-list mailing list