valgrind - victronenergy/venus GitHub Wiki

Valgrind

What is it

Valgrind is a programming tool for memory debugging, memory leak detection, and profiling. Homepage Wikipedia

How to get it

Download the sources: v3.11.00
Open a shell

#Go to the valgrind source directory:
cd valgrind_source_dir
#Source the environment setup script of the venus SDK:
source /opt/venus/current/environment-setup-armv7a-vfp-neon-ve-linux-gnueabi
#Configure the valgrind build:
./configure --host=armv7-ve-linux-gnueabi --prefix=$PWD/../valgrind_install
#Build:
make
#Install to local disk (../valgrind_install):
make install
#Copy to the target:
scp -r ../valgrind_install/* my_target:/

How to use it

Start your program using valgrind:
valgrind my_program_to_debug the_arguments_for_my_program

Valgrind has a lot of options that can be set. Example:
valgrind -v --num-callers=50 --track-origins=yes --leak-check=full /opt/color-control/vedirect-interface -v --log-before 25 --log-after 25 -t 3 --banner -s /dev/ttyUSB0