hammer-memory-profiler

Detect memory leaks and profile SDL3 HammerEngine memory usage with Valgrind and AddressSanitizer.

14|2|Updated Mar 24, 2025
One-click install
npx skills add https://github.com/Ronin15/SDL3_HammerEngine_Template --skill hammer-memory-profiler
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hammer-memory-profiler
Source: https://github.com/Ronin15/SDL3_HammerEngine_Template/tree/main/.claude/skills/hammer-memory-profiler
Command: npx skills add https://github.com/Ronin15/SDL3_HammerEngine_Template --skill hammer-memory-profiler

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires valgrind, python3, cmake, ninja, and includes scripts (resource) components.

What problem does it solve?

Memory leaks, excessive allocations, and inefficient buffer usage can severely degrade game engine performance and stability, leading to crashes and frame drops that are hard to diagnose manually. This Skill automates comprehensive memory analysis.

Core Features & Use Cases

  • Leak & Error Detection: Uses Valgrind Memcheck and AddressSanitizer to find memory leaks, invalid reads/writes, use-after-free errors, and double-frees.
  • Allocation Hotspot Profiling: Identifies per-frame allocations and buffer reuse anti-patterns that cause performance spikes, providing actionable optimization recommendations.
  • Comprehensive Reporting: Generates detailed Markdown reports with statistical analysis, optimization suggestions, and baseline comparisons to track memory usage trends over time.
  • Use Case: After implementing a new particle system, run a "Full Memory Profile" to ensure no new leaks were introduced, identify any per-frame allocations, and verify buffer reuse patterns, preventing performance regressions.

Quick Start

Profile memory usage for the AI system using a quick leak check.

Frequently Asked Questions about hammer-memory-profiler

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect memory leaks in my C++ game engine?

Memory leak detection uses Valgrind memcheck and AddressSanitizer to identify unreleased allocations, invalid reads/writes, use-after-free errors, and double-frees in your SDL3 HammerEngine code. Run a Quick Leak Check or Full Memory Profile to scan your codebase and generate a detailed report with specific leak locations and counts.

How can I find per-frame allocation hotspots causing performance drops?

Allocation Profiling identifies which subsystems (AI, Collision/Pathfinding, Core, Resources) allocate memory each frame and where buffer reuse anti-patterns occur. The profiler generates per-system breakdowns and optimization recommendations to eliminate performance spikes and frame drops.

What's the best way to profile memory usage across different game engine subsystems?

Target-specific subsystem profiling lets you isolate memory behavior for AI, Collision/Pathfinding, Core, and Resources independently. Use modes like Quick Leak Check, Allocation Profiling, or Full Memory Profile to analyze each system separately, compare baselines over time, and track optimization progress.

Can I use Valgrind and AddressSanitizer together for comprehensive memory analysis?

Yes. This Skill integrates both Valgrind memcheck and massif with AddressSanitizer to provide layered error detection and allocation profiling. Valgrind catches leaks and memory errors; AddressSanitizer detects runtime violations; together they give comprehensive SDL3 HammerEngine memory visibility.

How do I verify that new code doesn't introduce memory leaks or allocation regressions?

Run a Full Memory Profile after implementing changes, then compare the baseline against previous reports. The Skill generates Markdown reports with statistical analysis and baseline comparisons, letting you catch new leaks, per-frame allocations, and buffer reuse violations before they degrade performance.

What dependencies and tools do I need to run memory profiling?

Memory profiling requires Valgrind, Python3, CMake, and Ninja. The Skill ships with Bash scripts and a Python massif parser for automated analysis, so setup is automated once dependencies are installed. Verify all four tools are available before running profiles.