cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: memory leak

From: Ben Greear <greearb_at_candelatech.com>
Date: Wed, 17 Nov 2004 01:37:25 -0800

Daniel Stenberg wrote:
> Hi
>
> It pays of to scan external bug trackers every now and then. Nigel Horne
> reported a memory leak in the Redhat bugzilla:
>
> https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=139559
>
> I could repeat it with the recent CVS version just now (IPv6 enabled on
> Linux - haven't tried any other resolver yet). Annoylingly enough, I
> can't make valgrind produce one of those nice stack traces of the leak
> for me...
>
> I'll see if I can get some time to work on this.

Maybe you are not actually 'leaking' the memory, just placing
it in a linked-list or equivalent and not ever using it again?

Valgrind (and everything else I've seen) cannot find those types
of errors because there are still references to the object(s)...

With C++ I increment static counters in the constructors and decrement
in the destructor. Then can print out the instance counts to find
what is leaking. I'm sure you could do similar in c if you wrapped
up the malloc/frees for each object...

Ben

-- 
Ben Greear <greearb_at_candelatech.com>
Candela Technologies Inc  http://www.candelatech.com
Received on 2004-11-17