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

John Machin sjmachin at
Tue Aug 25 08:54:36 CEST 2009

On Aug 25, 2:08 am, Chris Withers <ch... at> wrote:
> Martin v. Löwis wrote:
> > Today, there are two cases when malloc returns memory on a typical
> > Unix system (in particular, in Linux malloc):
> > a) if the malloc block block is small (below page size), it is allocated
> >    from the brk heap, where it can only be returned if the last page of
> >    that heap is completely free, and
> > b) if the block is large (multiple pages), it gets returned to the
> >    system right away.
> > Case b) can only happen if the C malloc uses mmap to allocate large
> > blocks.
> I believe (and John will correct me if I'm wrong) that xlrd uses mmap,
> so why am I not seeing the memory being returned?

xlrd uses mmap to access the input file; this seems to have zero
correlation with "the C malloc uses mmap to allocate large blocks".

More information about the Python-list mailing list