Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'cpython': 0.05; '(so': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'terry': 0.09; "wouldn't": 0.11; 'extensions': 0.13; 'properly': 0.15; '(which,': 0.16; 'cyclic': 0.16; 'deleted,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'later': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'memory': 0.18; 'issue.': 0.20; 'balancing': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'question': 0.27; 'header:X-Complaints-To:1': 0.28; 'preceding': 0.29; 'thinks': 0.29; 'objects': 0.29; 'code': 0.31; 'getting': 0.33; 'to:addr:python-list': 0.33; 'produced': 0.33; "can't": 0.34; 'collecting': 0.35; 'nature': 0.35; 'pm,': 0.35; 'similar': 0.35; 'something': 0.35; 'received:org': 0.36; 'method': 0.36; 'subject:with': 0.36; 'should': 0.36; 'thank': 0.36; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'leading': 0.61; 'within': 0.64; 'here': 0.65; 'due': 0.66; 'leak.': 0.84; 'overlooked': 0.84; 'received:fios.verizon.net': 0.84; 'understand,': 0.84; 'hardest': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Messing with the GC Date: Sun, 20 Jan 2013 17:14:43 -0500 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358720118 news.xs4all.nl 6981 [2001:888:2000:d::a6]:39492 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37121 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