JVM Heap OOM labs by reproducing patterns with JDK 25
The author presents five reproducible JVM out-of-memory patterns covering unbounded caches, oversized batches, report builder retentions, ThreadLocal leaks, and leaked connections. Each pattern includes a reproduction script, diagnostic strategy using tools like heap and thread dumps, and a corrected version. Preliminary observations from benchmark tests indicate that different garbage collectors, such as Shenandoah and G1, handle these failure shapes dramatically differently. Open article →