I am doing a project on looking at free ware memory leak tools for C on linux.
Now i know there is the commerical ones ie Purify which is a great tool but I like to know what you use and what you think its the best.
Two freeware ones are electricfence and valgrind. Any other ones you use that are good or limited even?
Any websites with the tools and how you set them up be great.
Intending on using 4 of them.
I was more so looking for people's opinions what they used than jsut going by wikipedia.
Surely as engineers we must have opinions on tools????
It's a little hard to recommend anything other than valgrind.
There are alternatives, of course. Or this wouldn't be Linux we are talking about. Dmalloc, mpatrol and electric fence are the other three I know of. But individually they lack features present on valgrind and offer nothing that valgrind doesn't already, or so it seems to me.
To me, the biggest con of valgrind is its lack of portability. It's wrapped tight around the linux kernel, the x86 instruction set and even the GNU C compiler. Porting it is extremely hard. Thus, the lack of it. But I suppose that's the price you pay for these type of advanced tools.
There exists however a case for the methods these tools use:
Valgrind does full code analysis, while mpatrol forcefully crashes your program on a memory leak, for instance. Crashing seem excellent for dealing with memory leaks on a case-by-case basis. Maybe for small projects. But for mid to large size projects, this can't be the way to deal with memory management bugs. Or can it?
Well, for large projects, simpler tools in the form of a library that just replace the calls to malloc() and free() greatly simplify the most mundane memory debugging tasks, leaving a much cleaner program for valgrind to then take charge and work its magic on the most advanced debugging tasks. So, in fact, I think these tools complement each other even despite the obvious overlap. For small projects valgrind can be your only tool. But for large projects, I'd rather clean up the house a bit with tools like dmalloc, mpatrol and electric fence before moving on to valgrind.
Note however I never developed a large project in Linux. So don't take my word for it. This is just my reasoning.