Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #37131

Re: Messing with the GC

From jt@toerring.de (Jens Thoms Toerring)
Newsgroups comp.lang.python
Subject Re: Messing with the GC
Date 2013-01-21 01:02 +0000
Organization Freie Universitaet Berlin
Message-ID <am3icuFptjjU1@mid.uni-berlin.de> (permalink)
References <alvpvkFthuoU1@mid.uni-berlin.de> <am317sFljunU1@mid.uni-berlin.de> <mailman.708.1358720118.2939.python-list@python.org>

Show all headers | View raw


Terry Reedy <tjreedy@udel.edu> wrote:
> 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.

Definitely - I got started with Python having to write glue
code to get Python to work with a C++ library. And keeping
track of which side thinks it owns an object can sometimes
be a bit of a challenge...

> So I would report PySide code leading to segfaults to the
> PySide people.

Now that I'm more sure that it's unlikely to be a Python GC
related issue (or my not understanding what I'm doing, to be
precise) this is on my to-do list. But first I have to distill
things down to a very short example program still exhibiting
the problem - and experience tells me that this will most li-
kely result in the realization that it's not a PySide issue
at all but some misunderstanding on my side;-)

                         Best regards, Jens
-- 
  \   Jens Thoms Toerring  ___      jt@toerring.de
   \__________________________      http://toerring.de

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Messing with the GC jt@toerring.de (Jens Thoms Toerring) - 2013-01-19 14:47 +0000
  Re: Messing with the GC Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-19 16:24 +0000
    Re: Messing with the GC Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-19 16:34 +0000
  Re: Messing with the GC Terry Reedy <tjreedy@udel.edu> - 2013-01-19 11:40 -0500
  Re: Messing with the GC Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-19 16:44 +0000
  Re: Messing with the GC jt@toerring.de (Jens Thoms Toerring) - 2013-01-20 20:09 +0000
    Re: Messing with the GC Terry Reedy <tjreedy@udel.edu> - 2013-01-20 17:14 -0500
      Re: Messing with the GC jt@toerring.de (Jens Thoms Toerring) - 2013-01-21 01:02 +0000

csiph-web