一键导入
memory-profiling
Go application memory profiling and analysis. Use when investigating memory leaks or high memory usage.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Go application memory profiling and analysis. Use when investigating memory leaks or high memory usage.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Create a git worktree for a new TASK. Use when starting a new feature, fix, or refactor task that requires isolated development.
Go code quality rules and standards for kattle project. Apply when writing or reviewing Go code.
macOS native memory analysis tools (leaks, heap, vmmap, Instruments). Use for native app memory debugging.
Memory profile snapshot capture and baseline comparison. Use for verification after memory optimization.
React/TypeScript code quality rules for kattle frontend. Apply when writing or reviewing frontend code.
Run Go and frontend tests for kattle project. Use after code changes to verify correctness.
基于 SOC 职业分类
| name | memory-profiling |
| description | Go application memory profiling and analysis. Use when investigating memory leaks or high memory usage. |
| disable-model-invocation | true |
| user-invocable | true |
| allowed-tools | Bash, Read, Grep |
Investigate and analyze Go application memory usage through heap profiling and comparative analysis.
IMPORTANT: pprof server requires KATTLE_DEBUG=1 environment variable:
# Start the application with debug mode enabled
KATTLE_DEBUG=1 wails dev
Verify pprof server is running:
curl -s http://localhost:6060/debug/pprof/ > /dev/null && echo "pprof OK" || echo "pprof NOT available"
Before profiling, establish the current memory baseline:
ps aux | grep -E "(PID|kattle|gui)" | head -20
Verify baseline profile exists (from project root):
ls -lh baseline_heap.pb.gz 2>/dev/null || echo "No baseline found"
Collect a heap profile from the running application:
curl -o /tmp/heap.pb.gz http://localhost:6060/debug/pprof/heap
Verify collection was successful:
ls -lh /tmp/heap.pb.gz
Alternative: The app provides DumpMemory(label) function which saves labeled dumps to ~/kattle-dumps/:
heap_<timestamp>_<seq>_<label>.pb.gz~/kattle-dumps/Get the most significant memory allocators:
go tool pprof -top /tmp/heap.pb.gz | head -15
Compare current heap profile against a known baseline:
go tool pprof -diff_base=baseline_heap.pb.gz -top /tmp/heap.pb.gz
Or use the helper script:
bash /Users/hansuk.hong/P/kattle/.claude/skills/memory-profiling/scripts/compare-heap.sh [baseline_path] [current_path]
For deeper analysis, use interactive mode:
go tool pprof /tmp/heap.pb.gz
# Then use commands like: top, list <function>, alloc_space, alloc_objects
When analyzing memory profiles, report:
Memory Profile Analysis Report
==============================
Top 10 Allocators (Current):
1. package.function - X.XGB (XX%)
2. package.function - X.XGB (XX%)
...
Changes vs Baseline:
- package.function: +X.XGB (new allocation)
- package.function: -X.XGB (reduction)
Suspect Areas:
- package.function: Excessive allocation growth
- Recommendations for investigation