A rising old-generation line is not proof of a memory leak. It might mean the heap is too small, or that traffic grew, or that a full collection has not run yet. This tutorial works through a Java memory leak heap dump investigation on a small notification service whose heap climbs until it throws OutOfMemoryError : confirm the leak from GC logs, capture a live heap dump with jcmd , use Eclipse Memory Analyzer (MAT) to find the retaining reference, then fix it and prove the post-collection floor is flat.
The commands target JDK 21 and later, where jcmd and unified logging are the supported tools. The sample service keeps a static response cache and runs on a four-thread executor.β¦