[Python-Dev] Crash in new "trashcan" mechanism.

Christian Tismer tismer@tismer.com
Thu, 13 Apr 2000 13:56:18 +0200


Greg Stein wrote:
> 
> On Thu, 13 Apr 2000, Christian Tismer wrote:
> > Greg Stein wrote:
> >...
> > > Option 4: lose the trashcan mechanism. I don't think the free-threading
> > > issue was ever resolved.
> >
> > Option 5: Forget about free threading, change trashcan in a way
> > that it doesn't change the order of destruction, doesn't need
> > memory at all, and therefore does not change anything if it is
> > disabled in debug mode.
> 
> hehe... :-)
> 
> Definitely possible. Seems like you could just statically allocate an
> array of PyObject* and drop the pointers in there (without an INCREF or
> anything). Place them there, in order. Dunno about the debug stuff, and
> how that would affect it.

I could even better use the given objects-to-be-destroyed
as an explicit stack. Similar to what the debug delloc does,
I may abuse the type pointer as a stack pointer. Since
the refcount is zero, it can be abused to store a type code
(we have only 5 types to distinguish here), and there is enough
room for some state like a loop counter as well.

Given that, I can build a destructor without recursion, but
with an explicit stack and iteration. It would not interfere
with anything, since it actually does the same thing, just
in a different way, but in the same order, without mallocs.

Should I try it?  (say no and I'll do it anyway:)

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     where do you want to jump today?   http://www.stackless.com