Guide agents through Valgrind tools: Memcheck for memory errors, Cachegrind for cache simulation, Callgrind for call graphs, and Massif for heap profiling.
Compile with -g -O1 for best results. -O0 is also fine; avoid -O2+ which can produce false positives.
| --leak-check=full | summary | Full leak details | | --show-leak-kinds=all | definite | Show all leak kinds | | --track-origins=yes | no | Show where uninit values came from (slow) | | --error-exitcode=N | 0 | Exit N if errors found (CI integration) | | --log-file=file | stderr | Save report to file | | --suppressions=file | none | Suppress known FPs |
Valgrind profiler skill for memory error detection and cache profiling. Use when running Memcheck to find heap corruption, use-after-free, memory leaks, or uninitialised reads; or Cachegrind/Callgrind for cache simulation and function-level profiling. Activates on queries about valgrind, memcheck, heap leaks, use-after-free without sanitizers, cachegrind, callgrind, KCachegrind, or massif memory profiling. Source: mohitmishra786/low-level-dev-skills.