Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.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.061 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'explicitly': 0.05; 'subject:script': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'thread': 0.14; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; "shouldn't": 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; '[1]': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'subject:all': 0.32; 'call.': 0.33; 'fri,': 0.33; 'comment': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'should': 0.36; 'problems': 0.38; 'called': 0.40; 'most': 0.60; 'break': 0.61; 'stand': 0.64; 'worth': 0.66; 'here': 0.66; 'mar': 0.68; 'australia,': 0.84; 'avoided.': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=r4x9HQYe1dJtgg3Ix8NjLPGPeB8BTosc6eRPbxKgrPQ=; b=Phbh1Oy4jHjDs0yDyXkC08RxgUmYHESgBVyE7vJchYv8cREog5+YvhVLxZpTwP2mja D2xIsg7Xi4VndIeE6stmBqXWO6yJozcvvmV1CH+fNHrppCje3ducGr3MJUkgYa2k7mTz UcMapfecjX5fcZRWnsqCHUuYTnQG/spTkoqlU1rfYyue8rFweliOKKs+GzBtNBlTr/71 DQRxNs/Qia2AMSmAf7N2uwQkBNWXh8h7eanE/6c1zchbYBbduOkDp6Dmd7lD6zpZlvMW d047LNIV/rcW2EidNR/cZFUfPgTVa51ti/dCcx/T1dXDBp+TdSUJR0OlFCxMLSlQZgi8 wRFA== MIME-Version: 1.0 X-Received: by 10.194.59.210 with SMTP id b18mr14021345wjr.60.1394145816414; Thu, 06 Mar 2014 14:43:36 -0800 (PST) In-Reply-To: <87ha7bq7ls.fsf@elektro.pacujo.net> References: <87ha7bq7ls.fsf@elektro.pacujo.net> Date: Fri, 7 Mar 2014 09:43:36 +1100 Subject: Re: script uses up all memory From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394145824 news.xs4all.nl 2933 [2001:888:2000:d::a6]:42379 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67961 On Fri, Mar 7, 2014 at 9:34 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> Not all problems need to be solved perfectly :) But at very least, I >> would put a comment against your collect() call explaining what >> happens: that self.tools is involved in a refloop. Most Python code >> shouldn't have to call gc.collect(), so it's worth explaining why you >> are here. > > Refloops also are nothing to be avoided. Let GC do its job and forget > about it. I think this thread is proof that they are to be avoided. The GC wasn't doing its job unless explicitly called on. The true solution is to break the refloop; the quick fix is to call gc.collect(). I stand by the recommendation to put an explanatory comment against the collect call. [1] ChrisA [1] Here in Australia, that should be gc.reverse_charges().