
Run Valgrind Memcheck in CI as a Merge Gate
Run Valgrind Memcheck on your unit tests in CI with exit codes, suppressions and XML output so a new leak or invalid access fails the build before it merges.
Tag
7 posts

Run Valgrind Memcheck on your unit tests in CI with exit codes, suppressions and XML output so a new leak or invalid access fails the build before it merges.

Initialize C structs, arrays and malloc buffers so Valgrind reports no uninitialised reads, including the padding bytes that surprise you when data is written.

Write and maintain a Valgrind suppression file with --gen-suppressions, wildcards and match-leak-kinds so known library noise stops hiding real bugs.

Use valgrind --track-origins=yes to find where an uninitialised value was created, so the Memcheck report points at the real bug and not just the branch.

Learn the Memcheck leak categories, definitely, indirectly, possibly lost and still reachable, with a sample program for each and a fix-first order.

Run a C program under Valgrind Memcheck with --leak-check=full to find memory that was allocated and never freed, and read the report down to the source line.

Find memory errors, leaks, uninitialised reads and thread races in C and C++ with Valgrind, then profile heap and cache use, debug live and gate your CI.