Tuesday 3 December 2013

Try valgrind

Today, I will try valgrind, a tool to analyze c++ app.
Download the newest version:
wget http://valgrind.org/downloads/valgrind-3.9.0.tar.bz2
unzip it
tar jxvf valgrind-3.9.0.tar.bz2
 then enter the folder and compile it with root account
cd valgrind-3.9.0
make install
install required libs
apt-get install libc6-dbg

Then use valgrind to launch your app, e.g.
# valgrind --leak-check=yes --log-file=profile ./data_service_d ./config.xml &
You will get the below from profile file in current folder.
[1] 25076
root@vm8:/home/dist/tcp# ==25076== Memcheck, a memory error detector
==25076== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==25076== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==25076== Command: ./data_service_d ./config.xml

No comments: