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


Groups > comp.lang.python > #48101

Re: Debugging memory leaks

References <09917103-b35e-4728-8fea-bcb4ce2bd1af@googlegroups.com> <mailman.3165.1371104977.3114.python-list@python.org> <slrnkrkacg.2u4.giorgos.tzampanakis@brilliance.eternal-september.org> <51ba82b5$0$29997$c3e8da3$5496439d@news.astraweb.com>
Date 2013-06-14 19:30 +1000
Subject Re: Debugging memory leaks
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3279.1371202240.3114.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Jun 14, 2013 at 12:40 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Thu, 13 Jun 2013 20:15:42 +0000, Giorgos Tzampanakis wrote:
>
>>> 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?
> Sub-optimal, maybe, but terrible? Not even close. Terrible advice would
> be "open up all the ports on your firewall, that will fix it!"
>...
>
> My advice is to give yourself a deadline:
>
> "If I have not found the leak in one week, or found and fixed it in three
> weeks, then I'll probably never fix it and I should just give up and
> apply palliative reboots to work around the problem."
>
> Either that or hire an expert at debugging memory leaks.

It's terrible advice in generality, because it encourages a sloppiness
of thinking: "Memory usage doesn't matter, we'll just instruct people
to reset everything now and then". When you have a problem on your
hands, you always have to set a deadline [1] but sometimes you have to
set the deadline the other way, too: "I'll just reboot it now, but if
it runs out of memory within a week, I *have* to find the problem".
Also, I think everyone should have at least one shot at a project that
has to stay up for multiple months, preferably a year. Even if you
never actually achieve a whole year of uptime, *think* that way. It'll
help you get things into perspective: "If I were running this all
year, that might be an issue, but who cares about a memory leak in a
script that's going to be finished in an hour!".

[1] cf http://www.gnu.org/fun/jokes/last.bug.html

ChrisA

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


Thread

Debugging memory leaks writeson <doug.farrell@gmail.com> - 2013-06-12 18:24 -0700
  Re: Debugging memory leaks dieter <dieter@handshake.de> - 2013-06-13 08:29 +0200
    Re: Debugging memory leaks Giorgos Tzampanakis <giorgos.tzampanakis@gmail.com> - 2013-06-13 20:15 +0000
      Re: Debugging memory leaks Steve Simmons <square.steve@gmail.com> - 2013-06-13 22:45 +0100
      Re: Debugging memory leaks Chris Angelico <rosuav@gmail.com> - 2013-06-14 08:36 +1000
      Re: Debugging memory leaks Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-14 02:40 +0000
        Re: Debugging memory leaks Chris Angelico <rosuav@gmail.com> - 2013-06-14 19:30 +1000
        Re: Debugging memory leaks Giorgos Tzampanakis <giorgos.tzampanakis@gmail.com> - 2013-06-14 22:57 +0000
          Re: Debugging memory leaks Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-15 01:39 +0000
        Re: Debugging memory leaks dieter <dieter@handshake.de> - 2013-06-15 08:52 +0200
        Re: Debugging memory leaks Chris Angelico <rosuav@gmail.com> - 2013-06-15 17:21 +1000
        Re: Debugging memory leaks dieter <dieter@handshake.de> - 2013-06-16 08:18 +0200
      Re: Debugging memory leaks rusi <rustompmody@gmail.com> - 2013-06-14 06:53 -0700
        Re: Debugging memory leaks Chris Angelico <rosuav@gmail.com> - 2013-06-15 10:11 +1000
        Re: Debugging memory leaks Ben Finney <ben+python@benfinney.id.au> - 2013-06-15 10:16 +1000
          Re: Debugging memory leaks rusi <rustompmody@gmail.com> - 2013-06-14 20:16 -0700
            Re: Debugging memory leaks Ben Finney <ben+python@benfinney.id.au> - 2013-06-15 21:23 +1000
              Re: Debugging memory leaks rusi <rustompmody@gmail.com> - 2013-06-15 04:35 -0700
                Re: Debugging memory leaks Chris Angelico <rosuav@gmail.com> - 2013-06-15 21:54 +1000
  Re: Debugging memory leaks writeson <doug.farrell@gmail.com> - 2013-06-13 11:07 -0700
    Re: Debugging memory leaks Dave Angel <davea@davea.name> - 2013-06-13 14:44 -0400
  Re: Debugging memory leaks rusi <rustompmody@gmail.com> - 2013-06-14 05:36 -0700
  Re: Debugging memory leaks "Frank Millman" <frank@chagford.com> - 2013-06-21 08:50 +0200

csiph-web