profile-memory

Featured

Profile memory usage in sidecar using Go pprof, system tools, and heap analysis. Covers identifying memory leaks, goroutine leaks, file descriptor accumulation, and CPU profiling. Use when investigating memory issues, profiling performance, debugging memory leaks, or diagnosing unresponsive plugins.

Data & Documents 1,041 stars 80 forks Updated today MIT

Install

View on GitHub

Quality Score: 95/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Memory Profiling for Sidecar ## Quick Triage | Symptom | Tool | Action | |---------|------|--------| | High RSS / memory growth | vmmap, pprof heap | Check system memory, then heap profile | | Too many open files | lsof | Check FD count and breakdown | | High CPU | pprof cpu, ps | Capture CPU profile | | Goroutine leak | pprof goroutines | Check goroutine count and stacks | | Plugin unresponsive | lsof + goroutines | Check SQLite locks, blocked goroutines | ``` Triage flow: Is RSS high? -> Check FD count -> Check vmmap -> Check heap profile ``` ## System-Level Profiling (No pprof Required) ### Find the Process ```bash pgrep -f sidecar ps aux | grep sidecar ``` ### Basic Stats ```bash # RSS, VSZ, CPU%, thread count ps -o pid,rss,vsz,%cpu,nlwp -p <PID> # Human-readable RSS ps -o pid,rss -p <PID> | awk 'NR>1{printf "%d MB\n", $2/1024}' # Watch over time while true; do ps -o rss,%cpu -p <PID> | tail -1; sleep 5; done ``` ### System Memory **macOS (vmmap):** ```bash vmmap --summary <PID> ``` Key sections: VM_ALLOCATE (Go heap), MALLOC (C heap/SQLite), Physical footprint, Swapped. Red flags: - RESIDENT SIZE >500MB for idle sidecar - REGION COUNT in thousands for VM_ALLOCATE = mmap leak - SWAPPED SIZE growing = memory pressure **Linux:** ```bash cat /proc/<PID>/status | grep -E 'VmRSS|VmSize|Threads' pmap -x <PID> | tail -5 ls /proc/<PID>/fd | wc -l ``` ### File Descriptor Analysis ```bash # Count and breakdown lsof -p <PID> | wc -l lsof -p <PID> | awk '{print $5}'...

Details

Author
marcus
Repository
marcus/sidecar
Created
7 months ago
Last Updated
today
Language
Go
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category