Java Reference Types And Leaks

Reachability-driven memory in Java: the strong/soft/weak/phantom levels and exactly when each is cleared, WeakHashMap and its value-holds-key trap, Cleaner as a leak-reporting safety net rather than a release mechanism, finalization deprecation, and the leak catalogue — obsolete references in self-managed structures, listener registries, ThreadLocal on pooled threads, class-loader retention, non-static nested classes holding their enclosing instance, and caches that only grow. Use when heap grows with traffic and never returns after a full GC, when a redeploy raises Metaspace, when someone proposes a WeakReference or SoftReference cache, when a Cleaner or finalize() appears, when a ThreadLocal has no remove(), or when "restarting fixes it" is the operating procedure. Does not cover deterministic release of open resources (java-resource-management), reading a heap dump (heap-dump-analysis), finding allocation sites (allocation-profiling), or off-heap and native memory (off-heap-memory).

robsonkades 8ee51fe 4 files · 28.6 KB Updated

File contents

robsonkades/agent-skills/tree/main/skills/java-reference-types-and-leaks commit 8ee51fec48

Frequently asked questions

npx skillmds@latest add robsonkades/java-reference-types-and-leaks