[Python-Dev] RE: Program very slow to finish

Neil Schemenauer nas@python.ca
Tue, 6 Nov 2001 09:02:26 -0800


Tim Peters wrote:
> Can any Python-Dev'er make time to dig into the advisability of making
> PyMalloc the default?  I only took time for this because I'm out sick today,
> and was looking for something mindless to occupy my fevered thoughts; alas,
> it paid off <wink>.  I recall there are still thread issues wrt PyMalloc,
> and there *were* some reports that PyMalloc was slower on some platforms.

The problem is with extension modules.  We can make sure code in CVS
always has the big lock held when calling PyMalloc.  We can't be sure
that extension modules are safe.

The other, more serious problem is that many extension modules allocate
memory with PyObject_New() and free it with free() or PyMem_DEL()
instead of PyObject_Del() or PyObject_DEL().  If pymalloc is enabled
then memory allocated by a PyObject_* function must be freed by a
PyObject_* funciton.

mxDateTime is the first module I ran into that does this but there are
many others I'm sure.  I think almost all of the C modules I have
written do it.  The code in xxmodule.c used to do it as well.

 no-solutions-only-more-problems-hey-i'm-sick-today-too-ly y'rs Neil