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

Grant Edwards grante at visi.com
Wed Apr 25 12:07:00 EDT 2007


On 2007-04-25, Chris Mellon <arkanes at gmail.com> wrote:

> "Returning memory to the OS" doesn't affect exhaustion of your virtual
> address space. More likely, your nested loops are just creating more
> objects than is possible to hold within a single process.

I'm a bit fuzzy on this, but I don't think there _is_ a
practical way to "return memory to the OS" in many OSes.  For
example in Unix the C library uses the sbrk() call to increase
the size of the data segment when additional memory is needed
to handle soemthing like malloc() calls.  

In theory, one can use brk() to reduce the size of the data
segment, but I think making the segment smaller will produce
undefined behavior if any of the standard C library's dynamic
memory routines (e.g. malloc/free) have ever been used by the
program prior to the call to brk().

-- 
Grant Edwards                   grante             Yow! FEELINGS are cascading
                                  at               over me!!!
                               visi.com            



More information about the Python-list mailing list