profile-memory
Skill1.1k starsChanged 58 days agoMITView on GitHub
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.
- Installs packages
1 other project uses a version of this.
Trending
Quiet since October.about the whole repository
Most recently taken up by
- snehag01/reboundtheir own version, first seen Jul 7, 2026
Who's talking about marcus/sidecar
- chenrui333/homebrew-tap“sidecar 1.16.0”GitHub · Oct 5, 2026 · 1 reactions
- chenrui333/homebrew-tap“sidecar 1.14.0”GitHub · Sep 23, 2026 · 1 reactions
- chenrui333/homebrew-tap“sidecar 1.13.0”GitHub · Sep 3, 2026 · 1 reactions
- chenrui333/homebrew-tap“sidecar 1.11.2”GitHub · Aug 31, 2026 · 1 reactions
- chenrui333/homebrew-tap“sidecar 1.9.0”GitHub · Aug 27, 2026 · 1 reactions
The biggest 5 of 48 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 48
Talked about on GitHub and Bluesky (48 times).
On GitHub · 47
- Oct 5, 2026sidecar 1.16.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Sep 23, 2026sidecar 1.14.0 — chenrui333/homebrew-tap1 reaction · 2 comments
- Sep 3, 2026sidecar 1.13.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 31, 2026sidecar 1.11.2 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 27, 2026sidecar 1.9.0 — chenrui333/homebrew-tap1 reaction · 1 comment
42 more on GitHub
- Aug 26, 2026sidecar 1.8.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 25, 2026sidecar 1.7.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 25, 2026sidecar 1.6.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 24, 2026sidecar 1.5.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 23, 2026sidecar 1.4.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 21, 2026sidecar 1.3.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 21, 2026sidecar 1.2.2 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 20, 2026sidecar 1.2.1 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 20, 2026sidecar 1.2.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 19, 2026sidecar 1.1.1 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 19, 2026sidecar 1.1.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 18, 2026sidecar 1.0.3 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 17, 2026sidecar 1.0.2 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 17, 2026sidecar 1.0.1 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 17, 2026sidecar 1.0.0 — chenrui333/homebrew-tap1 reaction · 1 comment
- Aug 14, 2026sidecar 0.99.1 — chenrui333/homebrew-tap1 reaction
- Aug 14, 2026sidecar 0.99.0 — chenrui333/homebrew-tap1 reaction
- Aug 13, 2026sidecar 0.98.0 — chenrui333/homebrew-tap1 reaction
- Aug 12, 2026sidecar 0.97.0 — chenrui333/homebrew-tap1 reaction
- Aug 11, 2026sidecar 0.96.0 — chenrui333/homebrew-tap1 reaction
- Aug 11, 2026sidecar 0.95.0 — chenrui333/homebrew-tap1 reaction
- Aug 8, 2026sidecar 0.93.0 — chenrui333/homebrew-tap1 reaction
- Aug 7, 2026sidecar 0.92.0 — chenrui333/homebrew-tap1 reaction
- Aug 2, 2026sidecar 0.91.0 — chenrui333/homebrew-tap1 reaction
- Jul 31, 2026sidecar 0.90.0 — chenrui333/homebrew-tap1 reaction
- Jul 30, 2026sidecar 0.89.0 — chenrui333/homebrew-tap1 reaction
- Jul 28, 2026sidecar 0.88.2 — chenrui333/homebrew-tap1 reaction
- Jul 27, 2026sidecar 0.88.1 — chenrui333/homebrew-tap1 reaction
- Jul 25, 2026sidecar 0.87.1 — chenrui333/homebrew-tap1 reaction
- Jun 19, 2026sidecar 0.86.0 — chenrui333/homebrew-tap1 reaction
- Oct 3, 2026agent-skills.github.marcus.sidecar: 1.14.0 → 1.15.1 — sudosubin/agents.nix0 reactions
- Oct 1, 2026sidecar 1.15.1 — chenrui333/homebrew-tap0 reactions · 2 comments
- Sep 29, 2026agent-skills.github.marcus.sidecar: init at 1.14.0 — sudosubin/agents.nix0 reactions
- Sep 7, 2026Add Sidecar — manuelmeurer/agentmgmt0 reactions · 1 comment
- Apr 18, 2026sidecar 0.84.0 — chenrui333/homebrew-tap0 reactions
- Apr 17, 2026Feedback — sidequery/ghostree0 reactions
- Mar 24, 2026sidecar 0.83.0 — chenrui333/homebrew-tap0 reactions
- Mar 21, 2026sidecar 0.80.0 — chenrui333/homebrew-tap0 reactions
- Mar 21, 2026sidecar 0.79.0 — chenrui333/homebrew-tap0 reactions
- Mar 10, 2026sidecar 0.78.0 — chenrui333/homebrew-tap0 reactions
- Feb 10, 2026Research: Deep analysis of Sidecar - alignment check and alternatives — JulianDouma/speckle0 reactions
- Feb 9, 2026[Feature]: Persistent plan/todo tracking and checkpoints between plans — code-yeongyu/oh-my-openagent0 reactions · 6 comments
On Bluesky · 1
- Mar 4, 2026Great write up! The failures are especially valuable, watching this very closely. It might make sense to move merges to a subagent of the… — @faz.ms1 likes and repost
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- snehag01/rebound★ 4same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- coordinate-agentsSkill
- create-adapterSkill
- create-modalSkill
- create-pluginSkill
- create-promptSkill
- create-themeSkill
- drag-paneSkill
- feature-flagsSkill
- inline-editorSkill
- keyboard-shortcutsSkill
- merge-strategySkill
- port-herdr-integrationSkill
- project-switchingSkill
- release-sidecarSkill
- shell-integrationSkill
- sidecar-websiteSkill
- ui-featuresSkill
- worktree-switchingSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 189
Check goroutines for blocked operations:
- Very specific: line 193
Check SQLite locks: lsof -p <PID> | grep '\.db'
- Distinctive: line 194
Check stuck tea.Cmd goroutines:
- Very specific: line 198
Check for swap pressure: vmmap --summary <PID> | grep -E 'Physical|Swapped'
- Distinctive: line 233
If pprof available: heap snapshot comparison over time
- Very specific: line 234
If pprof unavailable: restart with SIDECAR_PPROF=1, reproduce the leak
- Very specific: line 241
Leave overnight (caffeinate -i on macOS)
- Distinctive: line 244
Check goroutines for stuck ones
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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 profileSystem-Level Profiling (No pprof Required)
Find the Process
pgrep -f sidecar
ps aux | grep sidecarBasic Stats
# 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; doneSystem Memory
macOS (vmmap):
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:
cat /proc/<PID>/status | grep -E 'VmRSS|VmSize|Threads'
pmap -x <PID> | tail -5
ls /proc/<PID>/fd | wc -lFile Descriptor Analysis
# Count and breakdown
lsof -p <PID> | wc -l
lsof -p <PID> | awk '{print $5}' | sort | uniq -c | sort -rn
# Find leaked files
lsof -p <PID> | grep REG | awk '{print $9}' | sort | uniq -c | sort -rn | head -20
# Check session file leaks
lsof -p <PID> | grep -c '\.claude/projects'
lsof -p <PID> | grep -c '\.codex/sessions'
# Watch FD count
while true; do echo "$(date): $(lsof -p <PID> 2>/dev/null | wc -l) FDs"; sleep 30; doneHealthy baselines: Total FDs 50-150, REG files 10-30, PIPEs 10-30, DIRs 5-15.
Red flags: 1000+ total FDs, same file opened 4+ times, growing count over time.
Thread Count
# macOS
ps -M -p <PID> | wc -l
# Linux
ls /proc/<PID>/task | wc -l
# Expected: 20-60 threads. 100+ = goroutine leak likelyGo pprof (Runtime Profiling)
Enable pprof
SIDECAR_PPROF=1 sidecar # Default port 6060
SIDECAR_PPROF=6061 sidecar # Custom portHeap Profile (Current Allocations)
curl http://localhost:6060/debug/pprof/heap > heap.prof
go tool pprof -top heap.prof
go tool pprof heap.prof # Interactive: top20, list <func>, webAllocs Profile (All Allocations Since Start)
curl http://localhost:6060/debug/pprof/allocs > allocs.prof
go tool pprof -top allocs.profGoroutine Profile
# Count
curl -s http://localhost:6060/debug/pprof/goroutine?debug=1 | head -1
# Full stacks
curl http://localhost:6060/debug/pprof/goroutine?debug=2 > goroutines.txt
# Find stuck goroutines
grep -A5 'runtime.chanrecv' goroutines.txtMemory Stats
curl http://localhost:6060/debug/pprof/heap?debug=1 | head -30Compare Snapshots (Best for Finding Leaks)
curl http://localhost:6060/debug/pprof/heap > heap1.prof
# Wait (1 hour or overnight)
curl http://localhost:6060/debug/pprof/heap > heap2.prof
go tool pprof -base heap1.prof heap2.prof
# Then: top20Continuous Monitoring
./scripts/mem-monitor.sh # Default: port 6060, 60s interval
./scripts/mem-monitor.sh 6061 30 # Custom port and intervalOutput: CSV time,heap_alloc_bytes,heap_inuse_bytes,goroutines,rss_mb to mem-YYYYMMDD-HHMMSS.log.
CPU Profile
curl http://localhost:6060/debug/pprof/profile?seconds=30 > cpu.prof
go tool pprof -top cpu.prof
go tool pprof cpu.prof # Interactive: top20, list <func>, webWeb UI
go tool pprof -http=:8080 http://localhost:6060/debug/pprof/heapRequires Graphviz (brew install graphviz / apt install graphviz) for flame graphs.
What to Look For
Goroutine leaks: Count should stabilize at 20-50 after startup. Steady growth = leak. Search for runtime.chanrecv1, runtime.chansend1, time.Sleep.
Heap growth: HeapAlloc should stabilize after loading sessions. Consistent upward trend = leak.
Common pprof signatures: bufio.Scanner (buffer not returned), json.Unmarshal (large objects retained), append in loops (slice growing), channel operations (blocked senders/receivers).
Diagnosing Unresponsive Plugins
- Check goroutines for blocked operations:
curl -s http://localhost:6060/debug/pprof/goroutine?debug=2 | grep -A10 'monitor\|td' - Check SQLite locks:
lsof -p <PID> | grep '\.db' - Check stuck tea.Cmd goroutines:
curl -s http://localhost:6060/debug/pprof/goroutine?debug=2 | grep -B2 'fetchData\|FetchData' - Check for swap pressure:
vmmap --summary <PID> | grep -E 'Physical|Swapped'
Common causes: SQLite locked by concurrent td CLI, memory pressure causing swap thrashing, goroutine blocked on unread channel, accumulating fetchData() goroutines.
Known Leak Patterns
File Descriptor Accumulation (Adapter/Watcher Layer)
Files: internal/adapter/claudecode/watcher.go etc. Uses fsnotify to watch directories.
Symptoms: RSS grows to 5-15GB overnight, lsof shows 1000+ session files open.
lsof -p <PID> | grep '\.claude/projects' | wc -l
lsof -p <PID> | grep '\.codex/sessions' | wc -lOutputBuffer Substring Retention
OutputBuffer.Update() uses strings.Split() creating substrings sharing backing array. NOT a leak if Update() keeps being called. Only retains if polling stops.
Poll Chain Duplication
Entering interactive mode without incrementing generation counter creates parallel poll chains. Doubles CPU but no memory leak. Fix: increment shellPollGeneration or pollGeneration on entry.
Go MADV_FREE (macOS)
Go runtime uses MADV_FREE marking pages reusable without returning to OS. RSS appears high but memory is available. NOT a leak. Use vmmap --summary and compare "Physical footprint (peak)" vs current.
Investigation Workflow
ps -o pid,rss,%cpu -p <PID>-- establish baselinelsof -p <PID> | wc -l-- if >200, focus on FD leaklsof -p <PID> | grep REG | awk '{print $9}' | sort | uniq -c | sort -rn | head -20vmmap --summary <PID>-- RESIDENT vs VIRTUAL, region count- If pprof available: heap snapshot comparison over time
- If pprof unavailable: restart with
SIDECAR_PPROF=1, reproduce the leak
Overnight Test Procedure
- Start:
SIDECAR_PPROF=1 sidecar - Baseline:
curl .../heap > baseline.prof - Note goroutine count
- Leave overnight (
caffeinate -ion macOS) - Morning: capture new profiles
- Compare:
go tool pprof -base baseline.prof morning.prof - Check goroutines for stuck ones
Notes
- pprof adds ~1-2MB overhead, no TUI performance impact
- HTTP server runs in separate goroutine, localhost only
- On macOS, vmmap/lsof need no special permissions for own processes
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

