User Tools

Site Tools


development:tools:quality

Table of Contents

Quality

PC-Lint

Valgrind

Use Valgrind to test for memory leaks:1)

valgrind --tool=memcheck --leak-check=full --track-origins=yes --show-reachable=yes --error-limit=no <executable>

or, if this produces too much warnings about uninitialised values:

valgrind --tool=memcheck --leak-check=full --undef-value-errors=no --show-reachable=yes --error-limit=no <executable>

Valgrind can also be used with CMake:2)

ctest -V -C Debug -T memcheck

when putting this line into CMakeLists.txt:

set(MEMORYCHECK_SUPPRESSIONS_FILE "${CMAKE_SOURCE_DIR}/.valgrind_suppressions" CACHE FILEPATH "" FORCE)
include(CTest)

Misc

  • Google AddressSanitizer (ASan): compile/link with flag -fsanitize=address
  • Google Breakpad
1)
See also the command line options page of Valgrind Memchk for details.
2)
For details see the CTest MemCheck Step documentation.
development/tools/quality.txt · Last modified: 2021/06/01 15:29 by Ralf Hoppe