Python not giving free memory back to the os get's me in real problems ...

Donn Cave donn at u.washington.edu
Wed Apr 25 13:55:35 EDT 2007


In article <mailman.6957.1177519294.32031.python-list at python.org>,
 Steven Howe <howe.steven at gmail.com> wrote:

> Interesting questions. What happens when an object is 'cleaned' up by
> using the 'del' command. Does the memory space stay in the python
> process, get handed back to the OS, or some combination of both?
> I remember 'C' on VMS at least, could be coerced into return memory on
> block boundaries. 'C++' was suppose to have garbage collect, but I was
> always doubtful it worked well.

Note that UNIX (and VMS) use "virtual" memory.  Real memory
space gets "handed back to the OS" by default -- if you don't
use it, you lose it.  It isn't coercion, but it does happen on
a per page basis, so fragmentation wastes space.

If a Python program uses more space than it ought to need, then
some knowledge of Python's reference counting allocation scheme
will be useful.  In particular, you need a fairly good grasp of
what a "reference" is.

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list