Python memory handling

Leo Kislov Leo.Kislov at gmail.com
Fri Jun 1 03:11:17 EDT 2007


On May 31, 8:06 am, frederic.pica at gmail.com wrote:
> Hello,
>
> I will try later with python 2.5 under linux, but as far as I can see,
> it's the same problem under my windows python 2.5
> After reading this document :http://evanjones.ca/memoryallocator/python-memory.pdf
>
> I think it's because list or dictionnaries are used by the parser, and
> python use an internal memory pool (not pymalloc) for them...
>

If I understand the document correctly you should be able to free
list
and dict caches if you create more than 80 new lists and dicts:

[list(), dict() for i in range(88)]

If it doesn't help that means 1) list&dict caches don't really work
like I think or 2) pymalloc cannot return memory because of
fragmentation and that is not simple to "fix".

  -- Leo




More information about the Python-list mailing list