Cyclic garbage collection and segfaults...

Michael Hudson mwh at python.net
Thu Jan 15 06:15:51 EST 2004


"Thomas Mailund" <mailund at birc.dk> writes:

> Hi group.
> 
> I have a problem with some C extensions I am working with and
> hope that some of you can help.  

[snippety]

> static void
> Simple_dealloc(SimpleObject *self)
> {
>     fprintf(stderr,"Simple_dealloc %p\n", self);
>     self->ob_type->tp_free((PyObject*)self); /* <= segfault here */

Well, you're calling tp_free from a tp_dealloc.  That doesn't *sound*
sensible to me.

> Can anyone explain what I'm doing wrong?  Or perhaps suggest a better
> solution to my "real" problem, if I'm approaching the problem completely
> wrong :-)

There are docs on this sort of thing.

Cheers,
mwh

-- 
 "Sturgeon's Law (90% of everything is crap) applies to Usenet."
 "Nothing guarantees that the 10% isn't crap, too."
                -- Gene Spafford's Axiom #2 of Usenet, and a corollary



More information about the Python-list mailing list