[Python-Dev] Malloc interface (was: [Patches] Re: Garbage collection patches for Python (fwd)

Vladimir Marangozov Vladimir.Marangozov@inrialpes.fr
Mon, 14 Feb 2000 12:43:19 +0100 (CET)


Fredrik Lundh wrote:
> 
> Vladimir Marangozov wrote:
> > PyMem_XDEL is very rare in the distribution...
> 
> "if (p) free(p)" is quite common, though.
> 
> > Okay, so you can use PyMem_DEL directly.
> 
> which means that PyMem_DEL works just
> fine for NULL pointers on almost all plat-
> forms, while PyMem_XDEL works on all
> platforms, but is slower if the pointer is
> usually not NULL.
> 
> seems a bit messy to me...
> 
> > If your point is to remove it, or to rename it to PyMem_DEL in
> > the distribution
> 
> my proposal is to have only one of these,
> and force people on non-ANSI platforms
> to provide a workaround.
> 
> </F>

Agreed. So the concrete proposal is this, right?

(mymalloc.h)

...
#define PyMem_FREE(p)	free((ANY *)p)
...

#define PyMem_DEL(p)	PyMem_FREE(p)
#define PyMem_XDEL(p)	PyMem_FREE(p)  /* obsolete */

-- 
       Vladimir MARANGOZOV          | Vladimir.Marangozov@inrialpes.fr
http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252