# Sample: a leak rooted by an event handler or a timer

EventLeakDemo has no cache. It creates objects that subscribe to a static event and objects that schedule a
timer, and never unsubscribes or disposes anything.

    ./collect.sh              # two gcdumps and artifacts/eventleak.dmp
    ./run-in-docker.sh        # same, inside a Linux container (use this on macOS)

Then let the agent investigate:

    dotnet-dump analyze artifacts/eventleak.dmp -c "dumpheap -stat" -c "exit"
    dotnet-dump analyze artifacts/eventleak.dmp -c "gcroot <address>" -c "exit"
    dotnet-dump analyze artifacts/eventleak.dmp -c "timerinfo" -c "exit"

gcroot on a timer-rooted object walks the whole timer queue and can print tens of thousands of lines. Only the
first line, the root, and the last one, the object, matter.

.claude/skills/analyzing-dotnet-dumps/SKILL.md is the skill the agent uses. Claude Code and GitHub Copilot read
it from that path as is; for Codex, move the analyzing-dotnet-dumps folder to .agents/skills/.

Prerequisites: .NET 10 SDK, and the diagnostic tools:

    dotnet tool install --global dotnet-dump
    dotnet tool install --global dotnet-gcdump
