Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'python,': 0.02; 'amounts': 0.07; 'debugging': 0.07; 'steve': 0.09; 'advice?': 0.09; 'bug.': 0.09; 'restart': 0.09; 'python': 0.11; 'bug': 0.12; '>does': 0.16; '>on': 0.16; '>the': 0.16; '>to': 0.16; 'analysing': 0.16; 'galaxy': 0.16; 'ignoring': 0.16; 'leaks': 0.16; 'tennis': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'small,': 0.19; 'addition,': 0.20; 'written': 0.21; 'seems': 0.21; '>>>': 0.22; 'memory': 0.22; 'email addr:gmail.com>': 0.22; 'header:User-Agent:1': 0.23; 'question': 0.24; 'player': 0.26; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; "doesn't": 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'easier': 0.31; 'usually': 0.31; 'this.': 0.32; 'probably': 0.32; 'url:python': 0.33; 'running': 0.33; '(i.e.': 0.33; 'problem': 0.35; 'problem.': 0.35; 'objects': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'wrong': 0.37; 'too': 0.37; 'server': 0.38; 'problems': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'use.': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'url:mail': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'tell': 0.60; 'mentioned': 0.61; 'times': 0.62; 'real': 0.63; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'due': 0.66; 'determine': 0.67; 'periodically': 0.68; 'analysis': 0.75; 'alone.': 0.84; 'leak': 0.84; 'much)': 0.84; 'terrible': 0.84; 'absolutely': 0.87; 'rankings': 0.91; 'received:mail- wi0-x229.google.com': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:in-reply-to:references:mime-version:content-type:subject :from:date:to:message-id; bh=ItLxq9mv1jCU2Af/mBr1tbXSCZypvz35nPPV+cR5VrA=; b=jtoXxTsXinGzsdDfqemU9qO6FahcVN4dNmr5Tc1KMEoObyzPUSX+0kFjrGV5KPnrCW CcngDqHwCYxCJUvIeA+xy1kNtT7JE78lLiD1aEorw0TGn1agFRA4CyuQx9+VK0gkBYzM ZY07JpFbixuxScHpGNcJRlLiPGpV3HxxSPfdgrg1PAAOIiAnAcgVeC3M0HqEuh/DiwML wK3Nx0m4fVE0mrB3cHUDqNIPpowj0M81Kz3qjbSxf4f/Ot1cgLKkPfMNe0Dy6POKxgzq lblDRz62DbVKKbwjAZgESw/d2AP8IHEQxrEX+nPA1nrZ3iU9zwUoO0pHiXxJHZNn6Atj 3g7Q== X-Received: by 10.194.21.231 with SMTP id y7mr1767244wje.94.1371162028918; Thu, 13 Jun 2013 15:20:28 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: References: <09917103-b35e-4728-8fea-bcb4ce2bd1af@googlegroups.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----5BAP8JN4YS2BEDC7B9GVFXM793V7XK" Subject: Re: Debugging memory leaks From: Steve Simmons Date: Thu, 13 Jun 2013 22:45:16 +0100 To: Giorgos Tzampanakis , python-list@python.org 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: 60 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371162031 news.xs4all.nl 15976 [2001:888:2000:d::a6]:50671 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:48032 ------5BAP8JN4YS2BEDC7B9GVFXM793V7XK Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Giorgos Tzampanakis wrote: >On 2013-06-13, dieter wrote: > >>> ... Anyway, my real question is how to go about debugging memory >leak >>> problems in Python, particularly for a long running server process >>> written with Twisted. I'm not sure how to use heapy or guppy, and >>> objgraph doesn't tell me enough to locate the problem. >> >> Analysing memory leaks is really difficult: huge amounts of data is >> involved and usually, it is almost impossible to determine which of >the >> mentioned objects are leaked and which are rightfully in use. In >> addition, long running Python processes usually have degrading memory >> use - due to memory fragmentation. There is nothing you can do >against >> this. >> >> Therefore: if the leak seems to be small, it may be much more >advicable >> to restart your process periodically (during times where a restart >does >> not hurt much) rather than try to find (and fix) the leaks. Only when >> the leak is large enough that it would force you to too frequent >> restarts, a deeper analysis may be advicable (large leaks are easier >to >> locate as well). > > >Am I the only one who thinks this is terrible advice? > >-- >Real (i.e. statistical) tennis and snooker player rankings and ratings: >http://www.statsfair.com/ >-- >http://mail.python.org/mailman/listinfo/python-list No you are not alone. Ignoring a bug is only sensible if you absolutely understand what is going wrong - and by the time you understand the problem that well, you probably have enough understanding to fix it. If tools are available (as the OP knows), then learn them and use them to find/fix the bug. Steve S Sent from a Galaxy far far away ------5BAP8JN4YS2BEDC7B9GVFXM793V7XK Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
Giorgos Tzampanakis <giorgos.tzampanakis@gmail.com> wrote:
On 2013-06-13, dieter wrote:

... Anyway, my real question is how to go about debugging memory leak
problems in Python, particularly for a long running server process
written with Twisted. I'm not sure how to use heapy or guppy, and
objgraph doesn't tell me enough to locate the problem.

Analysing memory leaks is really difficult: huge amounts of data is
involved and usually, it is almost impossible to determine which of the
mentioned objects are leaked and which are rightfully in use. In
addition, long running Python processes usually have degrading memory
use - due to memory fragmentation. There is nothing you can do against
this.

Therefore: if the leak seems to be small, it may be much more advicable
to restart your process periodically (during times where a restart does
not hurt much) rather than try to find (and fix) the leaks. Only when
the leak is large enough that it would force you to too frequent
restarts, a deeper analysis may be advicable (large leaks are easier to
locate as well).


Am I the only one who thinks this is terrible advice?

No you are not alone. Ignoring a bug is only sensible if you absolutely understand what is going wrong - and by the time you understand the problem that well, you probably have enough understanding to fix it. If tools are available (as the OP knows), then learn them and use them to find/fix the bug.
Steve S

Sent from a Galaxy far far away ------5BAP8JN4YS2BEDC7B9GVFXM793V7XK--