This walks you through Valgrind's suite of memory and profiling tools. Memcheck catches heap corruption, use-after-free, and leaks with full stack traces. Cachegrind simulates cache behavior, Callgrind builds call graphs for KCachegrind, and Massif tracks heap growth over time. The guide covers compilation flags, interpreting output, writing suppressions for third-party noise, and when to reach for ASan instead. Valgrind runs 10-50x slower than native, but it works without root access and catches errors that sanitizers miss. Good for CI pipelines and environments where you can't recompile with instrumentation.
- skills.sh installs
- 740
- GitHub stars
- 279
- last updated
- Aug 21, 2026
Install
$ npx -y skills add mohitmishra786/low-level-dev-skills --skill valgrind --agent claude-codeInstalls into .claude/skills of the current project.
Files
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 -g -O1 for best results. -O0 is also fine; avoid -O2+ which can produce false positives.
valgrind --tool=memcheck \
--leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
--error-exitcode=1 \
./prog [args]
Key flags:
Sponsors
Details
- Repository
- github.com/mohitmishra786/low-level-dev-skills
- Category
- Debugging
- First seen
- Jun 3, 2026
More from mohitmishra786/low-level-dev-skills
All 54- Flamegraphs728
- Assembly X86724
- Strace Ltrace711
- Cpu Cache Opt709
- Assembly Arm707
- Lldb703
- Elf Inspection702
- Simd Intrinsics701
- Make697
- Memory Model693
- Freertos691
- Linux Kernel Modules689
- Ninja681
- Heaptrack676
- Rust Profiling673
- Ebpf672
- Msvc Cl671
- Fuzzing670
- Binutils665
- Linkers Lto663
- Conan Vcpkg659
- Dynamic Linking650
- Rust Security624
- Rust Ffi613
