This walks Claude through using heaptrack, a low overhead heap profiler for Linux that's significantly faster than Valgrind massif (2-3x slowdown vs 20x). It covers recording allocation traces, interpreting heaptrack_print output to find leaks and hotspots, comparing memory usage between runs, and using the GUI for visualization. The workflow includes build setup with debug symbols, filtering options, and integration with Rust binaries using the system allocator. Reach for this when you need to find memory leaks or understand allocation patterns without the performance hit of heavier tools, though you'll need debug symbols for readable backtraces.

skills.sh installs
676
GitHub stars
279
last updated
Aug 21, 2026

Install

$ npx -y skills add mohitmishra786/low-level-dev-skills --skill heaptrack --agent claude-code

Installs into .claude/skills of the current project.

Files

heaptrack

Purpose

Guide agents through heaptrack for heap allocation profiling on Linux: recording allocation traces, analysing with heaptrack_print, identifying leaks and hotspots, and comparing runs.

Triggers

  • "How do I find memory allocation hotspots in my C++ program?"
  • "My program uses too much memory — how do I find where?"
  • "How do I use heaptrack to detect memory leaks?"
  • "What is heaptrack and how does it differ from Valgrind massif?"
  • "How do I compare memory usage between two program versions?"
  • "heaptrack_print output — how do I interpret it?"

Workflow

1. Installation

# Ubuntu/Debian
sudo apt-get install heaptrack heaptrack-gui

# Fedora
sudo dnf install heaptrack

# Arch
sudo pacman -S heaptrack

# Build from source
git clone https://github.com/KDE/heaptrack.git
cmake -S heaptrack -B heaptrack-build -DCMAKE_BUILD_TYPE=Release
cmake --build heaptrack-build -j$(nproc)

2. Basic usage

# Profile a program (generates heaptrack.<prog>.<pid>.zst)
heaptrack ./myapp arg1 arg2

# Attach to running process
heaptrack --pid 12345

# Analyse the trace file
heaptrack_print heaptrack.myapp.12345.zst

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
1davila7 avatarnestjs-expertdavila7/claude-code-templatesNest.js framework expert specializing in module architecture, dependency injection, middleware, guards, interceptors, testing with Jest/Supertest, TypeORM/Mongo672skills.sh installs
2getsentry avatarsentry-nextjs-sdkgetsentry/sentry-agent-skillsFull Sentry SDK setup for Next.js. Use when asked to "add Sentry to Next.js", "install @sentry/nextjs", or configure error monitoring, tracing, session replay, 665skills.sh installs
3jackwener avataropencli-repairjackwener/opencliDiagnose and fix broken OpenCLI adapters when websites change. Use when an opencli command fails with SELECTOR, EMPTY_RESULT, API_ERROR, or PAGE_CHANGED errors.657skills.sh installs
4mblode avataroptimise-seomblode/agent-skillsOptimises SEO and technical foundations for Next.js App Router apps, covering sitemaps, robots, meta tags, structured data, canonical URLs, redirects, indexing 647skills.sh installs
5win4r avatarmemory-lancedb-prowin4r/memory-lancedb-pro-skillComprehensive guide for maintaining, debugging, and upgrading the memory-lancedb-pro OpenClaw plugin — an enhanced LanceDB-backed long-term memory system with h645skills.sh installs
6jezweb avatardrizzle-orm-d1jezweb/claude-skillsBuild type-safe D1 databases with Drizzle ORM. Includes schema definition, migrations with Drizzle Kit, relations, and D1 batch API patterns. Prevents 18 errors640skills.sh installs