[Python-Dev] Memory management in the AST parser & compiler

Collin Winter collinw at gmail.com
Wed Nov 16 14:09:23 CET 2005


On 11/16/05, Niko Matsakis <niko at alum.mit.edu> wrote:
> - Another idea is to have trees of arenas: the idea is that when an
> arena is created, it is assigned a parent.  When an arena is freed,
> an arenas in its subtree are also freed.  This way you can have one
> master arena for exception handling, but if there is some sub-region
> where allocations can be grouped together, you create a sub-arena and
> free it when that region is complete.  Note that if you forget to
> free a sub-arena, it will eventually be freed.

You might be able to draw some inspiration from the Apache Portable
Runtime. It includes a memory pool management scheme that might be of
some interest.

The main project page is http://apr.apache.org, with the docs for the
mempool API located at
http://apr.apache.org/docs/apr/group__apr__pools.html

Collin Winter


More information about the Python-Dev mailing list