一键导入
memory-capture
Memory profile snapshot capture and baseline comparison. Use for verification after memory optimization.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Memory profile snapshot capture and baseline comparison. Use for verification after memory optimization.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
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.
Go application memory profiling and analysis. Use when investigating memory leaks or high memory usage.
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.
| name | memory-capture |
| description | Memory profile snapshot capture and baseline comparison. Use for verification after memory optimization. |
| disable-model-invocation | false |
| user-invocable | true |
| allowed-tools | Bash, Read |
This skill provides tools for capturing memory profile snapshots and comparing them against baseline profiles to verify memory optimization efforts.
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"
Note: Run all commands from project root directory where baseline_heap.pb.gz and baseline_goroutine.txt are located.
Captures the current heap memory profile:
curl -s -o /tmp/current_heap.pb.gz http://localhost:6060/debug/pprof/heap
This generates a compressed protobuf format heap profile that can be analyzed with go tool pprof.
Captures the current goroutine information:
curl -s http://localhost:6060/debug/pprof/goroutine?debug=1 > /tmp/current_goroutine.txt
This captures goroutine stack traces in text format for easy inspection.
Compare current heap profile against baseline using pprof's diff mode:
go tool pprof -diff_base=baseline_heap.pb.gz -top /tmp/current_heap.pb.gz
This shows the differences in memory allocation between the baseline and current profiles.
Extract and compare actual goroutine counts (not line counts):
# Extract goroutine count from first line "goroutine N [...]"
head -1 baseline_goroutine.txt | grep -oE 'goroutine [0-9]+' | cut -d' ' -f2
head -1 /tmp/current_goroutine.txt | grep -oE 'goroutine [0-9]+' | cut -d' ' -f2
Or count total goroutines in the profile:
grep -c '^goroutine' baseline_goroutine.txt
grep -c '^goroutine' /tmp/current_goroutine.txt
When optimization is verified and improvements are confirmed:
cp /tmp/current_heap.pb.gz baseline_heap.pb.gz
cp /tmp/current_goroutine.txt baseline_goroutine.txt
This updates the baseline profiles for future comparisons.
Use the provided capture-profile.sh script to capture both profiles in one command:
./scripts/capture-profile.sh [PORT]
Default port is 6060 if not specified.