Tagged articles

Inner Class

4 articles · Page 1 of 1
Java Captain
Java Captain
Sep 23, 2026 · Fundamentals

5 Common Java Memory Leak Scenarios and How to Detect Them

This article explains five common Java memory leak scenarios—long-lived collections, unclosed resources, ThreadLocal misuse, inner class references, and unregistered listeners—with code examples and recommends MAT and VisualVM for leak detection.

Garbage CollectionInner ClassJava
0 likes · 5 min read
5 Common Java Memory Leak Scenarios and How to Detect Them
Selected Java Interview Questions
Selected Java Interview Questions
Oct 6, 2022 · Backend Development

Understanding Java Inner Class Memory Leaks and How to Avoid Them

This article explains why non‑static inner classes in Java retain references to their outer class, causing memory leaks and eventual OutOfMemoryError, and demonstrates practical solutions such as avoiding references or converting the inner class to a static one, illustrated with code examples and debugging screenshots.

Garbage CollectionInner ClassMemory Leak
0 likes · 7 min read
Understanding Java Inner Class Memory Leaks and How to Avoid Them