valgrind is a suite of tools for debugging and profiling programs.
We use it for debugging and profiling
Linux executable files.
Despite the fact that it can do a whole lot of stuff, usually we use it as follows (when we do not forget) to test our applications for memory leaks:
valgrind --show-leak-kinds=all --leak-check=full $application $application_arguments;
The options we chose are the following:
--show-leak-kinds=allIt will show all leaks (definite, indirect, possible, reachable) in the full leak search (see next bullet)
--leak-check=fullthis option instructs
valgrindto search for memory leaks when the client program finishes.
Each individual leak will be shown in detail and be counted as an error.
These options are extremely useful as they will catch a lot of little leaks that you might have missed (e.g. closing a file, freeing some memory, …)
This post is also available in: Greek