← Guidelines and HOWTOs/Debugging/Valgrind You do not have permission to edit this page, for the following reason: The action you have requested is limited to users in one of the groups: Users, Administrators, trusted, KDEDevelopers. You can view and copy the source of this page. Valgrind is a [[Development/Tools|tool]] to analyze a program regarding memory leaks. == Leak Detection == One of the valgrind tools is the memcheck, that can be used to detect memory leaks during the execution of an application. To do that, valgrind can be started as: > valgrind --tool=memcheck --leak-check=yes -v ''appname'' where ''appname'' is the application you want to run, including its parameters, if it have to be called with any. As valgrind can produce a lot of output (and thus scroll out of your terminal), you can call valgrind redirecting its output to a file, so nothing gets lost. > valgrind --tool=memcheck --leak-check=yes -v ''appname'' 2>&1 | tee ''valgrind.log'' This will call valgrind as seen above, and will redirect all the output coming from both our application and valgrind to a file in the current directory falled ''valgrind.log'' (of course it is possible to use any file name of the log). === Minor tweaks === * executing valgrind with <tt>--leak-check=full</tt> instead of <tt>--leak-check=yes</tt> can give a more detailed output, especially about the found leaks == References == * [http://www.valgrind.org/ The Valgrind Homepage] * [http://www.tldp.org/HOWTO/Valgrind-HOWTO/ Excellent tutorial at TLDP] Template used on this page: Template:Path (view source) Return to Guidelines and HOWTOs/Debugging/Valgrind. Retrieved from "https://community.kde.org/Guidelines_and_HOWTOs/Debugging/Valgrind"