Messing with the GC
Terry Reedy
tjreedy at udel.edu
Sun Jan 20 17:14:43 EST 2013
On 1/20/2013 3:09 PM, Jens Thoms Toerring wrote:
> thank you for the explanations. I had overlooked the
> cyclic nature of what I had produced here and, of course,
> the GC can't be blamed for not collecting objects that are
> part of a cycle. The other question about the last refe-
> rence to an object vanishing within a method call (which,
> as I now clearly understand, can't happen and wouldn't make
> much sense) was triggered by a segmentation fault I get
> when I do something similar in PySide, so I was getting
> worried if it might be due to a GC issue. Now I know its
> got to be something different;-)
Perhaps the hardest part of writing C extensions to CPython directly in
C (versus something like Cython) is properly balancing increfs and
decrefs. An incref without a later decref can lead to a memory leak. A
decref without a preceding incref (so CPython thinks the object can be
deleted, when it should not be) can lead to segfaults. So I would report
PySide code leading to segfaults to the PySide people.
--
Terry Jan Reedy
More information about the Python-list
mailing list