[Python-Dev] Memory management question

Neil Schemenauer nas@python.ca
Fri, 27 Apr 2001 11:10:23 -0700


Guido van Rossum wrote:
> > Is there any (official) way to realloc the memory returned by
> > PyObject_NEW ?
> 
> Not if the object participates in GC.

I going to see if I can fix this for 2.2.  My current thinking is
that there should be memory management APIs for GC objects,
something like:

    PyObject_GC_New()
    PyObject_GC_NewVar()
    PyObject_GC_Realloc()
    PyObject_GC_Del()

The non-GC APIs would no longer have to check the type flags
which would be a bit of a speed win.  The _AS_GC, _FROM_GC macros
would not have to be used as much and the GC implementation would
have more freedom about how to allocate things.

  Neil