Subject: Finding memory leaks

From: Marcus Lundblad <[email-masked]>
Date: Fri, 11 Jul 2003 15:43:34 +0200 (CEST)

I was thinking about an aid in finding memory leaks.
We already have wrappers for malloc,calloc,realloc.

So it would be easy to make theese macros (to be able to print the name of
the argument for debug) and also print-out the returned adress.

Then the hard part: there will need to be a wrapper for free
(safefree?) that can print the adress when debugging. So, here all
occurences of free will have to be replaced.

(By the way, free(ptr) is equivalent to realloc(ptr,0) )

Is this an idea that sounds interesting? Or am I the only one who think
finding memory leaks can be tough?

I know there is tests run with Purify at times, but this to me seems like
a good thing. The problem is that it might get a lot of output for stuff
that is not relevant when debugging some newly written code.

//Marcus

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Dan Espen <[email-masked]>
Date: Fri, 11 Jul 2003 10:45:36 -0400

> that is not relevant when debugging some newly written code.

I believe there are a few OpenSource memory checkers:

http://www.consistent.org/terran/memorycheck.shtml

Purify does more than leak checking, it has bounds checking
and notices if you process uninitialised memory.
It sometimes flags things that aren't real problems,
but its not a big problem.

I've been tied up doing work for quite a while, and it looks
like it will continue but I usually find time to run tests
under Purify when asked.

-- 
Dan Espen                           E-mail: [email-masked]

---

From: [email-masked]
Date: Mon, 14 Jul 2003 18:51:19 +0200

> like it will continue but I usually find time to run tests

We tried insure++ in the past which is cool but waaaaay too
expensive.  We never managed to get a free copy from the company,
so we have to do without it.  Recently, Olivier discovered
valgrind, which does a fair job in finding memory leaks without
having to recompile.  ANd it's free.  You will want to use the
latest code from CVS (sourceforge).

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]