Skip to main content

Debugging OutOfMemoryError: Heap Dumps, Eclipse MAT, and the Five Leak Patterns in Spring Apps

Five real Spring Boot apps, each driven to a genuine OutOfMemoryError under a constrained heap, each with a real .hprof dump read through Eclipse Memory Analyzer's headless batch report generator. Static caches, ThreadLocal, unremoved listeners, classloader leaks, and unbounded queues -- with the real console transcripts and MAT leak-suspect evidence for every one, plus what the JVM's own defaults quietly leave out when the crash happens in a container.

JVM Flags for Spring Boot in Containers (JDK 25/27): The Production Cheat Sheet

A flag-by-flag reference for running Spring Boot in containers on JDK 25 and JDK 27, measured in real Docker containers: how UseContainerSupport derives CPU count, collector and heap size from the cgroup, why MaxRAMPercentage fails safely while a hardcoded -Xmx gets the container SIGKILLed, the ActiveProcessorCount lie that inflates GC threads, native memory the heap percentage doesn't cover, and what JEP 523 and JEP 534 change by default on JDK 27.

Java Flight Recorder and Mission Control: Profiling a Live Spring Boot App in 20 Minutes

A hands-on guide to profiling a live Spring Boot app with Java Flight Recorder: real jcmd and jfr sessions finding a CPU hot method, allocation pressure and lock contention, a custom business event, and four traps that corrupt or hide data — a threshold that silently discards 12ms waits, a shared threshold between concurrent recordings, events lost to a missing try/finally, and a dump/stop bug that doubles every event.

Immutable Collections in Java: List.of vs unmodifiableList vs copyOf

Collections.unmodifiableList, List.of and List.copyOf all refuse direct mutation, but only two of them reject null elements and only one of them is a real snapshot rather than a live view over a list you still hold a mutable reference to. Covers null handling, views vs copies, real JMH construction/read overhead, a brief Guava ImmutableList comparison, and the record field that looks immutable but isn't.

Sequenced Collections in Java 21+: getFirst, getLast and reversed()

JEP 431's SequencedCollection, SequencedSet and SequencedMap give List, Deque, LinkedHashSet, LinkedHashMap and TreeMap a shared getFirst/getLast/reversed() contract. This replaces the stream.reduce((a,b)->b) and skip(size-1) tricks people use to find the last element of a Set, with real javap-verified interface output and a working demo of why reversed() is a live view, not a copy.

Top 40 Java Collections Interview Questions (HashMap Internals to Fail-Fast Iterators)

Forty Java Collections interview questions grouped from fundamentals to failure modes, verified against real JDK 25 source and real runs: HashMap bucket layout and treeification reproduced via reflection, a real ConcurrentModificationException alongside the well-known case where it silently does not fire, and the equals/hashCode contract broken and fixed in code.

HTTP/3 in the Java HTTP Client (JEP 517): Migrating from HttpClient 11

JEP 517 added HTTP/3 to java.net.http in Java 26 as an opt-in. What the opt-in looks like, how the three H3_DISCOVERY modes behave, what fallback costs in seconds, why proxies silently downgrade you, and how HTTP/1.1, HTTP/2 and HTTP/3 compare under simulated packet loss, all measured on a local server with captured transcripts.

How to Sort a HashMap by Value (and Key) in Java

The shortest correct way to sort a Java HashMap by value or key (stream into a LinkedHashMap), plus the traps: a TreeMap with a value comparator silently drops tied entries, top-N with a PriorityQueue measured against sort-and-limit in JMH, and JDK 21+ sequenced collections (reversed, firstEntry).