You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Valgrind

  • Valgrind is a programming tool for memory debugging, memory leak detection, and profiling
  • It shows memory leaks, deallocation errors in the program

Build steps

Follow the link for RPi build steps- RDK-B R-Pi Build guide

Installation

By adding the below changes, we can install valgrind in RPI-target

Adding valgrind to the packaging will enable the valgrind support for your platform 

File : meta-cmf-raspberrypi/recipes-core/packagegroups/packagegroup-rdk-oss-broadband.bbappend  

diff --git a/recipes-core/packagegroups/packagegroup-rdk-oss-broadband.bbappend b/recipes-core/packagegroups/packagegroup-rdk-oss-broadband.bbappend 

index a74b9e4..93dee0f 100644 

--- a/recipes-core/packagegroups/packagegroup-rdk-oss-broadband.bbappend 

+++ b/recipes-core/packagegroups/packagegroup-rdk-oss-broadband.bbappend 

@@ -12,6 +12,11 @@ RDEPENDS_packagegroup-rdk-oss-broadband_append = " \ 

     rtl8192eu \ 

     rtl88x2bu \ 

     ethtool \ 

+    valgrind \ 

" 

Valgrind also needs some of the previously defined features, specifically:

$YOCTO_BUILD/conf/local.conf:

EXTRA_IMAGE_FEATURES += " dbg-pkgs tools-debug "

Execution

Command to check memory leak

valgrind --tool=memcheck --leak-check=full --show-reachable=yes --num-callers=20 --track-fds=yes /usr/bin/<component>

Defining the options:

--tool=memcheck: "To the check the memory"
​
--leak-check=full: "each individual leak will be shown in detail"
  
--show-reachable=yes: "When enabled, the leak detector also shows "reachable" and "indirectly lost" blocks"
​
--num-callers=20: "Specifies the maximum number of entries shown in stack traces that identify program locations"
​
--track-fds=yes: "When enabled, Valgrind will print out a list of open file descriptors on exit."
​
/usr/bin/<component>: "Component's binary path"


Attached valgrind results for reference,
valgrind_pandm.txt


  • No labels