Valgrind Purpose Guide agents through Valgrind tools: Memcheck for memory errors, Cachegrind for cache simulation, Callgrind for call graphs, and Massif for heap profiling. Triggers - "My program has a memory leak / use-after-free" - "I can't use ASan — can I use Valgrind instead?" - "How do I profile cache behaviour without perf?" - "How do I visualize call graphs with Callgrind?" - "How do I profile heap allocation patterns?" - "Valgrind reports errors in third-party code I can't fix" Workflow 1. Memcheck — memory error detection Compile with for best results. is also fine; avoid + which ca…