[Patches] [ python-Patches-536909 ] pymalloc for types and other cleanups

noreply@sourceforge.net noreply@sourceforge.net
Sat, 30 Mar 2002 23:11:35 -0800


Patches item #536909, was opened at 2002-03-29 16:11
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=536909&group_id=5470

Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Neil Schemenauer (nascheme)
>Assigned to: Neil Schemenauer (nascheme)
Summary: pymalloc for types and other cleanups

Initial Comment:
This patch changes typeobject to use pymalloc for
managing the memory of subclassable types. It also
fixes a bug that caused an interpreter built without
GC to crash.

Testing this patch was a bitch.  There are three knobs
related to MM now (with-cycle-gc, with-pymalloc,
and PYMALLOC_DEBUG).  I think I found different bugs
when testing with each possible combination.

There's one bit of ugliness in this patch.  Extension
module writers have to use _PyMalloc_Del to initialize
the tp_free pointer.  There should be a "public"
function for that.

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2002-03-31 02:11

Message:
Logged In: YES 
user_id=31435

Neil, I appreciate the work!  I'm afraid I screwed you at 
the same time.  How do you want to proceed?  I think "the 
plan" now is that we go back to the PyObject_XXX interface, 
and when pymalloc is enabled map most flavors of "free 
memory" ({Py{Mem, Object}_{Del, DEL, Free, FREE}) to the 
pymalloc free.  You're not required <wink> to work on this, 
but if you've got some spare energy I could sure use the 
help.

----------------------------------------------------------------------

Comment By: Neil Schemenauer (nascheme)
Date: 2002-03-29 18:09

Message:
Logged In: YES 
user_id=35752

I'm counting on Tim to finish PyMem_NukeIt.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-03-29 17:47

Message:
Logged In: YES 
user_id=21627

I see another memory allocation family here: What function
should objects allocated through PyType_GenericAlloc be
released with?

If you change the behaviour of PyType_GenericAlloc, all
types in extensions written for 2.2 that use
PyType_GenericAlloc will break, since they will still have
PyObject_Del in their tp_free slot.

I believe "families" should always be complete, so along
with PyType_GenericAlloc goes PyType_GenericFree.

If you want it fully backwards compatible, you need to
introduce PyType_PyMallocAlloc...

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=536909&group_id=5470