<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/1999/html" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>Ross Burton</title><link>http://www.burtonini.com/blog</link><description>A potted account of Ross' life</description><language>en</language><ttl>60</ttl><dc:creator>Ross Burton</dc:creator><admin:generatorAgent rdf:resource="http://pyblosxom.sourceforge.net/"/><admin:errorReportsTo rdf:resource="mailto:ross@burtonini.com"/><item><title>Debugging Sucks</title><guid isPermaLink="false">computers/debugging-20031014</guid><link>http://www.burtonini.com/blog/computers/debugging-20031014</link><description>I hate debugging. I hate debugging memory leaks more. I really hate debugging memory leaks when Valgrind won't work. Today ...</description><content:encoded><![CDATA[  <p>
    I hate debugging.  I hate debugging memory leaks more.  I <em>really</em>
    hate debugging memory leaks when <a
    href="http://developer.kde.org/~sewardj/">Valgrind</a> won't work.
  </p>
  <p>
    Today I finally had a poke at the memory leak in <tt>gnome-cups-icon</tt> in
    Debian. This isn't a little memory leak, its 20 bytes or so every few
    seconds, which soon adds up to a 600M process when left running
    overnight. As Valgrind just refused to play along with Bonobo, I had to
    resort to more hacky measures:
  </p>
  <pre>
#include &lt;stdlib.h&gt;
static void
print_usage(void)
{
        char buf[256];
        sprintf(buf, "grep VmRSS /proc/%d/status", getpid());
        system(buf);
}

static char *
get_default (void)
{
        ...
        print_usage();
        default_dest = cupsGetDest (NULL, NULL, num_dests, dests);
        print_usage ();
        ...
  </pre>
  <p>
    Urrrgh.  In the end I traced the leak to <tt>cupsFreeDests()</tt> not
    actually freeing any memory, which sucks.
  </p>
]]></content:encoded><dc:date>2003-10-14T14:26:18Z</dc:date></item></channel></rss>