“Valgrind is a CPU simulator which is used by KDE and many other projects to profile and debug our programmes. In the interview below Valgrind author Julian Seward talks to KDE Dot News about why he developed Valgrind, how you can use it and, most importantly, where the name comes from.”
These steps to get Linux working could lead to WindowsXP running on a MacIntel. $12’000 would do nicely for FOSS development. http://windowsxp.onmac.net/The%20Contest.html
Edit: Accidently commented in the wrong article :/ Oh well, there goes my karma.
Edited 2006-02-21 10:20
Since my university days, my approach for writing leak-free code was meticulously doing code review (in addition to taking special care whenever allocating memory), and while it’s possible to get good results in this manner, it takes too long to check.
Then I recently did some reading (at http://www.enlightenment.org/Main/Debugging/) and decided to give Valgrind a try (in particular for it’s memory leak detection) and it is wonderful.
This came about after I had spotted what looked to be some leaks in some code, and I thought I’d give the tool a try to confirm my suspicions… Valgrind not only allowed me to confirm them all, but it also found some extra issues that I hadn’t spotted as well
I personally like the Massif tool that is part of valgrind.
It is able to show you a graph of the memory still in use at each moment in time separated by the function which allocated the memory.
http://developer.gnome.org/doc/guides/optimisation/Massif.html
I found the links in the previous comments to be very insightful. I would love to know more about optimizing and profiling, especially C programs. Could anyone point at guides and tools with this purpose?
> Could anyone point at guides and tools with this purpose?
On C programs optimization, I found the paper “Getting the Least Out of Your C Compiler” by Jakob Engblom to be a very good start. Although it is written with embedded software in mind (which may not be what you are looking for), it should be general enough to be relevant for other uses of C as well.
You can find this paper (PDF file), as well as a bunch of others, here : http://www.engbloms.se/jakob_publications.html
You may also be interested by the slides available here : http://www.fefe.de/ (search for “Writing Small Software” in the page). They are a good start, too.
Valgrind has saved my butt more than once! Saved me countless hours of thinking, etc.
And I’ve never even tried it for race conditions (this is broken in the latest which I have), just memory errors.
Seriously, Mr. Seward, thank you, thank you, thank you!
In the article, it asks if it works with Kdevelop. It certainly does. But I prefer to run it alone or running Kcachegrind to view the profiling data. For memory leaks only, using Valgrind inside Kdevelop is fine and has saved me plenty of times. It’s so nice to see your memory allocations in real-time too and where the most allocations are taking place. Makes development on PC’s somewhat lacking IMHO. At least in freely available tools.