Re: Why is this a memory leak? (Valgrind / Linux)
From: Måns Rullgård (mru_at_inprovide.com)
Date: 12/14/04
- Previous message: Shcherbyak Grigoriy: "Re: code completion in KDevelop"
- In reply to: John: "Why is this a memory leak? (Valgrind / Linux)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: Shcherbyak Grigoriy: "Re: code completion in KDevelop"
- In reply to: John: "Why is this a memory leak? (Valgrind / Linux)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|