Questions about gh-135552 "Segmentation fault, possibly due to a GC issue"

hi all! Please let me know if this isn’t the right forum to post this in; I didn’t want to ask right on the issue itself since it’s not relevant to fixing it

I’ve been following along with this issue and I have a few clarifying questions, if anyone can help.

In nascheme’s helpful summary of the bug, they explain that types use weakrefs to reference subclasses. Why does this need to be weakrefs; my guess is to avoid issues with cyclic references, but is that the case?

In the 3rd paragraph they explain that calling finalizers on cyclic garbage can cause objects to become ‘resurrected’; what does that mean in detail? They say this makes them reachable by the gc; what is happening during finalization that might make a previously unreachable object reachable?

1 Like

An object becomes available for garbage collection when there are no references to it.

If it has a del method, then that’s called, before the object is freed.

But suppose that that method makes a new reference to the object, such as by storing a reference to it in a global variable.

There’s a reference to the object, so it shouldn’t be freed.

It has been resurrected.

thank you!