2011年6月26日星期日

内存泄漏检测

Linux下C++代码内存泄漏检测:

valgrind --leak-check=full ./parser

之前需要安装valgrind (sudo apt-get install valgrind)

mac上安装valgrind可参考
http://valgrind.org/downloads/repository.html

The Current (3.0 and later) Repository

To check out code from the current repository (anonymous, read-only SVN access), do this:
  svn co svn://svn.valgrind.org/valgrind/trunk valgrind
To build the checked out code, follow the instructions in the README file that the checkout should give you. Alternatively, the following should work:
  cd valgrind
  ./autogen.sh
  ./configure --prefix=...
  make
  make install
To do the checkout, you'll need a Subversion client, version 1.1.0 or later. Versions prior to 1.1.0 do not properly handle the symbolic links in our tree.
To do the build, you'll need automake version 1.10 or later and a compatible version of autoconf (e.g. 2.68). These should come as standard on any non-ancient Linux distribution.

没有评论: