<< to CrossControl homepage

Support & Service Center

Valgrind use in the Virtual Machine and ARM platforms

Printer-friendly versionPrinter-friendly versionPDF versionPDF version

Valgrind is a tool for memory debugging, memory leak detection, profiling and threading bugs.  It is a commonly used tool to check and resolve memory leaks and performance bottlenecks.  We have Valgrind installed in the Maximatecc Virtual Machine by default.  We do not have it installed on the Linux ARM platforms by default but the files and instructions in this article will instruct how to install into the ARM platform.  It should be noted that running Valgrind on the ARM devices is very slow and it will be difficult to perform a full profile and analysis of a sufficiently large application on the ARM device itself.  Due to this, we recommend running and checking the application in the Virtual Machine where it will be much faster.  Pieces of code that must be checked on the display (eg. CAN, IO etc) can be split off from the main application if possible so only a small piece of code is checked.

Attached to this article you will find a PDF 'Profiling application code with Valgrind for Linux' which summarizes the process of checking application code with Valgrind as well as provides some best practices.

Installing Valgrind on the ARM platform:

  • Download the 'valgrind_arm.tar.gz' file attached to this article and copy over to the '/opt' directory of the display (via 'scp' or FileZilla)
  • Extract the file with 'tar -xf valgrind_arm.tar.gz'
  • Download the 'lib_nonstripped_arm.tar.gz' file
  • Re-mount the file system as read write with: 'mount -o remount,rw /'
  • Copy the 'lib_nonstripped_arm.tar.gz' file to the '/lib' folder of the OS
  • Extract the file: 'tar -xf lib_nonstripped_arm.tar.gz'
  • Sync the libraries with the 'sync' command
  • Re-mount the filesystem back to read only: 'mount -o remount,ro /'

After the above commands you should be able to use valgrind as demonstrated in the PDF (eg. '/opt/valgrind/bin/valgrind -tool=callgrind...)


Valgrind will only run applicatinos built for the platform it is installed on.  So, for instance, you will not be able to check applications with Valgrind built for the ARM platform inside the Virtual Machine since these are different platforms.  You will either need to check the ARM binary on the ARM device itself (which as mentioned above is very slow) or rebuild the application for the Virtual Machine and then you can check the application with Valgrind inside the VM.