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-code

Installs 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

Recommended

More Debugging
1alirezarezvani avataranalytics-trackingalirezarezvani/claude-skillsSet up, audit, and debug analytics tracking implementation — GA4, Google Tag Manager, event taxonomy, conversion tracking, and data quality. Use when building a731skills.sh installs
2mohitmishra786 avatarflamegraphsmohitmishra786/low-level-dev-skillsFlamegraph generation and interpretation skill. Use when converting perf, Valgrind Callgrind, or other profiler output into SVG flamegraphs using Brendan Gregg'728skills.sh installs
3madteacher avatarflutter-networkingmadteacher/mad-agents-skillsImplement, fix, debug, review, or refactor Flutter networking code for HTTP/REST APIs, WebSocket realtime flows, authentication and token refresh, request heade727skills.sh installs
4zate avatargodot-optimizationzate/cc-godotExpert knowledge of Godot performance optimization, profiling, bottleneck identification, and optimization techniques. Use when helping improve game performance725skills.sh installs
5joellewis avatarexchange-connectivityjoellewis/finance_skillsGuide the design and management of trading venue connectivity and market data infrastructure. Owns the FIX session layer (logon, heartbeats, sequence number gap706skills.sh installs
6mohitmishra786 avatarlldbmohitmishra786/low-level-dev-skillsLLDB debugger skill for C/C++/Swift/Objective-C programs. Use when debugging with LLDB on macOS, FreeBSD, or Linux-clang environments, mapping GDB mental models703skills.sh installs