[Python-Dev] Re: RFC: malloc cleanup

Vladimir Marangozov Vladimir.Marangozov@inrialpes.fr
Tue, 22 Feb 2000 21:14:56 +0100 (CET)


Jean-Claude Wippler wrote:
> 
> Hello Vladimir,
> 
> >1) All C extension modules, without exceptions, would be silently redirected
> >   to use the Python malloc wrappers. Silently means that no one line of code
> >   would need to be modified and the modules will continue to compile and run
> >   as before.  (i.e. all macros and functions used in C code remain the same)
> 
> Have you taken C++ into account (i.e. new and new[] in the C++ runtime
> calling malloc)?

As long as Python objects are allocated and freed with PyObject_NEW/DEL,
and Python memory is manipulated with the Python malloc interfaces,
I don't see a problem, even if the core, or some extensions are compiled
with a C++ compiler.

C++ constructors and destructors use malloc (usually), but remain completely
symmetrical. That is what's allocated via malloc() is released via free().

Why, should I be aware of something special?

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