Skip to content

Valgrind

David Mansolino edited this page Nov 5, 2018 · 2 revisions

Using Valgrind on Linux

Valgrindcan be used to detect memory management and threading bugs, and profile Webots programs in detail.

Installation

Install Valgrind using default package manager:

sudo apt-get install valgrind

Usage

The Valgrind option --smc-check=all have to be set in order to profile the webots-bin application. This is due to some issues with the QtWebKit module (see bug report). Note that Webots should be compiled in debug mode before running Valgrind.

Basic usage example from the main webots folder:

valgrind --log-file=valgrind.out --smc-check=all bin/webots-bin

Issues with Valgrind 3.11.0

With Valgrind 3.11.0, Webots may not start in Valgrind. Valgrind reports:

vex: the `impossible' happened:
   isZeroU

valgrind: the 'impossible' happened:
   LibVEX called failure_exit().

cf. https://bugs.launchpad.net/ubuntu/+source/valgrind/+bug/1574437

In this case, upgrade to valgrind 3.12.0 using these instructions:

# Download Valgrind 3.12.0 from http://valgrind.org/downloads/
sudo apt remove valgrind
sudo apt install automake
cd ~/software/
mv ../Downloads/valgrind-3.12.0.tar.bz2 .
tar jxf valgrind-3.12.0.tar.bz2 
cd valgrind-3.12.0/
./autogen.sh 
./configure 
make -jX
sudo make install
Clone this wiki locally