xaf-memory-leaks
Installation
SKILL.md
XAF: Memory Leak Prevention
Root Causes
| Cause | Symptom |
|---|---|
| Event handler not unsubscribed | Memory grows with navigation; handler fires multiple times |
| ObjectSpace not disposed | Memory grows proportional to data accessed |
| Static reference to instance | Objects never GC'd; growing memory profile |
| CollectionSource not disposed | Cached data retained after view closes |
| ObjectSpace/objects in Session | Memory scales with active user count; session timeout failures |
| Controller holds undisposed resources | Finalizer queue pressure; slow GC |
Event Handler Pattern — Most Common Leak
Every += in OnActivated needs a matching -= in both OnDeactivated and Dispose.