I Used to Think Memory Leaks Were Loud in Java | by Martin | Jul, 2026 | MediumSitemapOpen in appSign up<br>Sign in
Medium Logo
Get app<br>Write
Search
Sign up<br>Sign in
Member-only story
I Used to Think Memory Leaks Were Loud in Java
Martin
3 min read·<br>Just now
Listen
Share
Press enter or click to view image in full size
Source: Stackoverflow.comI used to think memory leaks were loud.<br>I thought they announced themselves with sudden crashes, red dashboards, and immediate chaos. Then I inherited a legacy billing service. It did not crash violently. It just slowly gasped for air over two weeks until it choked.<br>The CPU would creep up. The garbage collector would panic. The response times would spike. Then, the container would quietly die. We would restart it. The cycle would begin again.<br>The code was not obviously broken. It was written by people smarter than me. It used modern frameworks. It had unit tests. But at 2 AM on a Tuesday, unit tests do not matter. Production matters.<br>I had to find what was eating the heap.<br>The Hunt<br>You can always throw more RAM at a memory leak. That is the cowardly way out. It just buys you a few more days before the next crash. It does not solve the problem; it just delays the paging.<br>I started with the dashboards. The JVM heap usage graph looked like a perfect sawtooth wave, but the baseline kept rising. Every time the garbage collector ran a major sweep, it reclaimed a little less memory.<br>I needed a snapshot of the dying system.
Written by Martin<br>468 followers<br>·2 following
Developer since the early 2000s
Help
Status
About
Careers
Press
Blog
Store
Privacy
Rules
Terms
Text to speech