| This article documents a developer tool.
A list of available devtools is available, together with installation instructions.
Valgrind is an Open Source suite of tools for debugging and profiling Linux programs. It works only on x86 (and PPC).
Valgrind is a really powerful and easy to use tool that can save you a lot of debugging time.
Because Valgrind works by simulating the x86 processor and instrumenting the binaries on the fly, it can control the program execution completely. As a downsize it makes program execution 10-300 times slower than normally, depending on the used Valgrind tools (massif is the fastest, callgrind the slowest) and can take a huge amount of memory.
The tools available for Valgrind are:
- Massif: run-time memory usage graph and hyperlinked allocation backtraces (allocation are sorted by time*size)
- Memcheck: Detects memory access errors (writes to freed memory, reads from uninitialized memory) and memory leaks (process has lost a pointer to allocation). This reports less false positives than any other (Open Source) tool and can call gdb when the error happens
- Cachegrind: Performance profiling which can be started and stopped at any moment and the results can be sorted according to instructions, cache hits etc.
- Callgrind: Like Cachegrind, but stores also callgraph information (but can show only instruction counts). Works very well with the Kcachegrind UI.
- Helgrind: Detects race conditions when (p)threaded programs access global data
 Building Valgrind
Please note that in maemo environment we need to export G_SLICE="always-malloc" to avoid getting bogus leakage reports from Glib GSlice allocator (its TLS usage confuses Valgrind allocation tracking). If you build your own Valgrind version, you should use this setting when Valgrinding programs using Glib (e.g. all maemo UI apps).
 External links
 See also
- This page was last modified on 11 March 2010, at 15:24.
- This page has been accessed 3,416 times.