richlander/dotnet-skills · Archived

dotnet-allocation-triage

Cross-tool workflow to reduce .NET heap allocations — static triage with dotnet-inspect, then confirm the win with BenchmarkDotNet or dotnet-trace/dotnet-counters before changing code. Use when chasing allocation hot spots on a hot path.

Installation

$ npx skills add richlander/dotnet-skills --skill dotnet-allocation-triage

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from richlander/dotnet-skills.

npx skills add richlander/dotnet-skills

Browse all from richlander/dotnet-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 57
Default branch main
Open issues 0
Status Archived

Skill metadata

Parsed from SKILL.md frontmatter.

Version0.1.0

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,044 B
  • docs SUMMARY.md 271 B

History

  1. First recorded snapshot · 1 installs

SKILL.md

.NET Allocation Triage Workflow

Find allocation hot spots statically, confirm they matter dynamically, fix, then verify — pairing dotnet-inspect (static, IL-precise) with a benchmark or profiler (dynamic, ground truth). This skill is the workflow; for tool capabilities, output modes, shapes, and flags, defer to the version-matched guide:

dnx dotnet-inspect -y -- skill

Workflow

  1. Triage statically. Build Release, then run dotnet-inspect's Performance Triage over the assembly to get a ranked list of pay-dirt allocation sites (member, shape, fix, confidence, in-loop). The cheapest first pass — works on a binary and its dependencies, no profiler needed. See the embedded guide for the exact command and filters.
  2. Confirm it's real. Static triage finds candidates; only a dynamic tool proves a win:

- Micro: wrap the hot method in a BenchmarkDotNet benchmark with [MemoryDiagnoser]; record allocated bytes before/after. - Running app: capture a GC/allocation trace with dotnet-trace collect --profile gc-verbose, or watch System.Runtime GC counters with dotnet-counters monitor, and confirm the member shows up and shrinks.

  1. Fix, then re-triage to confirm the row is gone and re-benchmark to confirm the allocation dropped.

When to use / not use

  • Use on hot-path code with a measured or suspected allocation problem.
  • Don't micro-optimize cold paths (startup, config, one-time init).
  • Don't ship a fix on static triage alone — confirm with a benchmark or profiler first.

Findings are heuristics over IL: candidates with evidence, not proof. Always confirm impact with a benchmark or profiler and human review before changing production code.