Top 3 OOM Patterns in Heap Dumps

Identifying large object arrays, excessive cache growth, and thread-local variable leaks reveals common OutOfMemory error patterns within heap dumps.

The top 3

  1. Top Cause: Unreleased Memory Leaks: The most frequent OOM pattern in heap dumps is memory leaks, where objects are no longer actively used but remain referenced, preventing garbage collection. Tools like Eclipse MAT identify 'leak suspects' by analyzing dominator trees, often pointing to static collections, `ThreadLocal` variables, or unremoved listeners as culprits.
  2. Biggest Culprit: Over-Sized Data Structures: Another common OOM pattern stems from legitimate but excessively large data structures like `HashMaps` or `ArrayLists`, often acting as caches without proper size limits or eviction policies. Heap dumps reveal these by showing a single or a few classes consuming a disproportionately large percentage of the retained heap.
  3. Hidden Threat: High Allocation Rate Overwhelming GC: This pattern occurs when an application creates objects at such a high rate that the garbage collector cannot reclaim memory fast enough, even if many objects are short-lived. Heap dumps might show a high number of objects in the young generation or a rapid accumulation of objects, often preceding a `GC overhead limit exceeded` error, indicating the JVM is spending too much time on GC with little memory freed.

Sources

Open the full topic