Re: Why is this a memory leak? (Valgrind / Linux)

From: Måns Rullgård (mru_at_inprovide.com)
Date: 12/14/04

  • Next message: Måns Rullgård: "Re: Validate a pointer"
    Date: Tue, 14 Dec 2004 12:57:22 +0100
    
    

    John <john@domain.invalid> writes:

    > Linux (SuSE) x86 gcc (GCC) 3.3 20030226 (prerelease) (SuSE Linux)
    >
    > I'm hunting down a memory leak reported by Valgrind. I've been able
    > to write a small program that produces the valgrind report. That
    > program is included below.
    >
    > My question is based on this: If on line 45 I call put_on_list()
    > instead of call_pol(), valgrind doesn't report any memory leaks. It
    > only happens when I use one additional layer of function call to
    > populate the list. See the LEAK SUMMARY section in the Valgrind
    > output after the source listing.

    There is no call to free(), so you have a leak. It's possible that by
    calling different functions, your stack usage is somehow different,
    and might play tricks. Run with --show-reachable=yes, and see if the
    leak gets reported among the still reachable blocks instead.

    -- 
    Måns Rullgård
    mru@inprovide.com
    

  • Next message: Måns Rullgård: "Re: Validate a pointer"

    Relevant Pages

    • Why is this a memory leak? (Valgrind / Linux)
      ... I'm hunting down a memory leak reported by Valgrind. ... valgrind doesn't report any memory leaks. ...
      (comp.unix.programmer)
    • Re: Dinkumware STL, MFC and memory leak
      ... but report memory leak in MFC Debug Mode. ... > Is a bug of Dinkum STL or MSVC6 or misuse? ...
      (comp.lang.cpp)
    • Re: Debugging memory leak
      ... Valgrind gives the following report. ... suggest a leak on ld-2.3.2.so if I am reading it right.But if I ... change my pam library to pam_unix.so the leak seems to go away. ...
      (comp.os.linux.development.apps)
    • Re: OT: Shades Of "Let Him Have It"?
      ... >Maybe the Beeb are sceptical as the "leak" being genuine. ... Google News was initially showing 8 references to the story within ... organisations thought the story worth running; the Beeb didn't. ... A leak of a poor report still yields poor information ...
      (uk.radio.amateur)
    • Re: Horowitz: The 39 blows and the "Lorraine Cross"
      ... They only comfirmed that the kid was being watched ... > autopsy report to the crime scene to the background on the credit ... This is a gargantuan leak. ... > kid's house hanging around with his mother. ...
      (alt.true-crime)