MySQL QA Episode 11: Valgrind Testing: Pro’s, Con’s, Why and How

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.

  1. Pro’s/Why
  2. Con’s
  3. How
    1. Using the latest version
      sudo [yum/apt-get] install valgrind
      sudo [yum/apt-get] remove valgrind
      sudo [yum/apt-get] install bzip2 glibc*
      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
    2. VGDB (cd ./mysql-test)
      ./lib/v1/ –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
    3. pquery Valgrind
    4. Valgrind stacks overview & analysis

Full-screen viewing @ 720p resolution recommended.

Checkout the full MySQL QA Series today!

Share this post

Comments (5)

  • Jörg Brühe

    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?


    August 5, 2015 at 6:10 am
  • Roel Van de Paar

    Hi Jörg, you mean installing Flash to watch the YouTube video? That’s not required; use the HTML5 YouTube player: instead.

    August 5, 2015 at 11:40 pm
  • Shahriyar Rzayev

    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

    August 23, 2015 at 8:25 am
  • Shahriyar Rzayev

    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

    make install

    You may have some problems with installing MySQL from source code. So i have noted them in our local community page:

    August 23, 2015 at 8:54 am
  • Roel Van de Paar

    There’s also some build* scripts in percona-qa.

    @All, please note we have moved percona-qa to GitHub:

    To clone it, use:
    $ sudo yum install git
    $ cd ~
    $ git clone was also put directly into this repository (and it is maintained there), so *no* need anymore to separately fetch lp:randgen.

    November 26, 2015 at 1:01 am

Comments are closed.

Use Percona's Technical Forum to ask any follow-up questions on this blog topic.