1. 安装valgrind(官网:http://valgrind.org/)
(1) 解压源代码文件:tar xjf valgrind-3.7.0.tar.bz2
(2) 进入解压后的目录:cd valgrind-3.7.0
(3)编译:
./configure
make
2. 编译wireshark源代码(官网:http://www.wireshark.org/)
(1) 解压源代码文件:tar xjf wireshark-1.6.1.tar.bz2
(2) 进入解压后的目录:cd wireshark-1.6.1
(3)编译:
./autogen.sh
./configure
make
3. 在wireshark源代码的根目录(比如说,/root/wireshark-1.6.1)里,执行以下命令:
valgrind --tool=memcheck --leak-check=full --trace-children=yes --log-file=/root/valgrind.log /root/wireshark-1.6.1/wireshark
命令执行之后,wireshark将会启动,然后使用wireshark来抓几个包,接着把wireshark关闭,这时内存泄露的报告将会写到/root/valgrind.log文件里。
PS:
--tool=<name> use the Valgrind tool named <name> [memcheck]
--leak-check=no|summary|full search for memory leaks at exit? [summary]
--trace-children=no|yes Valgrind-ise child processes (follow execve)? [no]
--log-file=<file> log messages to <file>