Today’s episode is all about Valgrind – from the pro’s to the con’s, from the why to the how! This episode will be of interest to anyone who is or wants to work with Valgrind on a regular or semi-regular basis.
- Pro’s/Why
- Con’s
- How
- Using the latest version
sudo [yum/apt-get] install valgrind
#OR#
sudo [yum/apt-get] remove valgrind
sudo [yum/apt-get] install bzip2 glibc*
wget http://valgrind.org/downloads/valgrind-3.10.1.tar.bz2
tar -xf valgrind-3.10.1.tar.bz2; cd valgrind-3.10.1
./configure; make; sudo make install
valgrind –version # This should now read 3.10.1 - VGDB (cd ./mysql-test)
./lib/v1/mysql-test-run.pl –start-and-exit –valgrind –valgrind-option=”–leak-check=yes”
–valgrind-option=”–vgdb=yes” –valgrind-option=”–vgdb-error=0″ 1st
#OR# valgrind –leak-check=yes –vgdb=yes –vgdb-error=0 ./mysqld –options…
#ALSO CONSIDER# –num-callers=40 –show-reachable=yes –track-origins=yes
gdb /Percona-server/bin/mysqld
(gdb) target remote | vgdb
(gdb) bt - pquery Valgrind
- Valgrind stacks overview & analysis
- Using the latest version
Full-screen viewing @ 720p resolution recommended.
Checkout the full MySQL QA Series today!
I sure would like to follow your explanations – but I won’t install insecure stuff like Flash.
Please: Isn’t there a safe way to publish your material?
Regards,
Jörg
Hi Jörg, you mean installing Flash to watch the YouTube video? That’s not required; use the HTML5 YouTube player: https://www.youtube.com/html5 instead.
If you try to install valgrind debuginfo package and got something like:
“debuginfo-install: command not found”
Just install yum-utils package:
[root@centos-base ~]# yum install yum-utils
Just for a note if somebody wondering how to have a “Debug” or “Valgrind” MySQL on they own. Simply it means that you have compiled MySQL from source code with:
-DWITH_DEBUG=1 for “Debug” build, -DWITH_VALGRIND=1 for “Valgrind” build.
The full command will be like above for eg with MySQL 5.6.19:
cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql-5.6.19 -DMYSQL_DATADIR=/var/lib/mysql -DSYSCONFDIR=/opt/mysql-5.6.19 -DWITH_SSL=system -DMYSQL_TCP_PORT=3307 -DMYSQL_UNIX_ADDR=/opt/mysql-5.6.19/mysqld.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=1 -DCOMPILATION_COMMENT=”Shahriyar Rzayev’s Ubuntu MySQL-5.6.19″ -DOPTIMIZER_TRACE=1 -DWITH_ZLIB=system -DWITH_VALGRIND=1 -DCMAKE_C_FLAGS=-DHAVE_purify -DCMAKE_CXX_FLAGS=-DHAVE_purify
Then:
make
make install
You may have some problems with installing MySQL from source code. So i have noted them in our local community page:
http://mysql.az/installing-mysql-from-source-cmake-issues/
There’s also some build* scripts in percona-qa.
@All, please note we have moved percona-qa to GitHub:
https://github.com/Percona-QA/percona-qa
To clone it, use:
$ sudo yum install git
$ cd ~
$ git clone https://github.com/Percona-QA/percona-qa.git
reducer.sh was also put directly into this repository (and it is maintained there), so *no* need anymore to separately fetch lp:randgen.