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-Fähigkeit zur Speicherfehlererkennung und Cache-Profilerstellung. Verwenden Sie diese Option, wenn Sie Memcheck ausführen, um Heap-Beschädigungen, Use-After-Free, Speicherlecks oder nicht initialisierte Lesevorgänge zu finden. oder Cachegrind/Callgrind für Cache-Simulation und Profilerstellung auf Funktionsebene. Wird bei Abfragen zu Valgrind, Memcheck, Heap-Lecks, Use-After-Free ohne Sanitizer, Cachegrind, Callgrind, KCachegrind oder Massif Memory Profiling aktiviert. Quelle: mohitmishra786/low-level-dev-skills.