[Python-Dev] Activating pymalloc

M.-A. Lemburg mal@lemburg.com
Fri, 15 Mar 2002 10:18:39 +0100


"Martin v. Loewis" wrote:
> 
> > > A lot of extensions will break.  The example code in xxmodule.c was
> > > "wrong" for years.
> >
> > Ditto Zope (as Guido said), ditto Marc-Andre's extensions, ditto NumPy
> > (IIRC), yadda yadda yadda.  I don't know whether MarkH has tried the massive
> > Win32 extensions with pymalloc yet.
> 
> I wonder whether one could design a script that analyses Python code
> for asymmetric usage of memory management functions, e.g. trying to match
> 
>    expression->FIELD = ALLOCATOR;
>    DEALLOCATOR(other_expression->FIELD);
> 
> This would complain if there is a FIELD that has no symmetric usage,
> or if a certain allocator has no counterpart at all in a source file.
> 
> I then wonder if that script would have found the errors you cite.

I think better would be to add some instrumentation to the
interpreter so that extension authors can easily debug the
memory and object allocation management in their extensions.

I am thinking of a configure option which enables python -d to
generate a log file with all uses of these functions and
macros logged to that file.

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/