Valgrind is a popular tool for debugging memory leak in C++. By using this tool you will be able to see objects that were forgotten to be freed/deleted, and potential bug from code that Valgrind doesn't like.
Installing Valgrind on older Mac OS is very simple and can be done from brew. However the most recent Mac OS 10.10 (Yosemite), has not been officially supported by Valgrind. Hence to be able to use this, installation must be done manually from their latest svn trunk which is also very simple.
svn checkout svn://svn.valgrind.org/valgrind/trunk
Followed by going into the directory trunk and:
./autogen.sh
make
make install
While running autogen.sh one might get an error saying that aclocal was not found.
./autogen.sh: line 6: aclocal: command not found
error: while running 'aclocal'In this case the automake needs to be installed prior to running this script. The easiest way to do it is to install from brew, such as:
brew install automake
To start using valgrind:
valgrind --leak-check=full --show-reachable=yes --log-info=leak.log "[your program and args]"
For less detailed information and log to stdout:
valgrind --leak-check=yes "[your program and args]"
2 comments: (+add yours?)
MacBook-Air:trunk me$ ./autogen.sh
running: aclocal
./autogen.sh: line 6: aclocal: command not found
error: while running 'aclocal'
what could cause this error, do You know?
Do you have automake installed in your mac? It seems like the error is caused by unable to find aclocal which is part of automake.
Post a Comment