Valgrind » History » Revision 3
Revision 2 (icy, 2009-06-09 14:22) → Revision 3/4 (stbuehler, 2009-07-05 22:05)
h1. Valgrind
"Valgrind":http://valgrind.org is a versatile tool and highly recommended for anyone debugging applications under Linux.
You can use it to find bugs or hunt down performance bottlenecks.
h2. Finding Memleaks / Bugs
h3. Memcheck
Docs: http://valgrind.org/docs/manual/mc-manual.html
It is sometimes a little bit hard to find mem-leaks in glib based applications, so just use this:
<pre>
G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind --leak-check=full --show-reachable=yes --leak-resolution=high <yourapplication>
</pre>
h2. Critical Warnings
Abort on critical warnings:
<pre>
G_DEBUG=fatal_criticals
</pre>
h2. Finding Bottlenecks
Use KCachegrind to visualize the outputs of Callgrind and Cachegrind.
h3. Callgrind
Docs: http://valgrind.org/docs/manual/cl-manual.html
<pre>
valgrind --tool=callgrind <yourapplication>
</pre>
h3. Cachegrind
Docs: http://valgrind.org/docs/manual/cg-manual.html
<pre>
valgrind --tool=cachegrind <yourapplication>
</pre>