Andreas Grabner About the Author

Andreas Grabner has been helping companies improve their application performance for 15+ years. He is a regular contributor within Web Performance and DevOps communities and a prolific speaker at user groups and conferences around the world. Reach him at @grabnerandi

Memory Leak Detection in Production – a Field Report

Memory Leaks are painful – especially when they crash your production servers. But – how does one go about analyzing the leak that only happens in the production environment? Here is a story I was told while on-site with one of our clients. I asked: “Chris, tell me about a recent performance problem and how you solved it.”

He replied: “I’ve got a good one. We had these memory problems in production with memory increasing steadily and eventually crashing a JVM. First thing I asked my Ops guy is to capture a Java Heap Dump. His response was: ’Heap WHAT?’ So I started explaining how to take a Heap Dump on the JVMs. Two hours later he had the file on the production machines. Now it was time to transfer this file out of Prod on my Desk. This took about 20 minutes. When I opened the file it turned out to be corrupted. So – back to capturing a new dump and transferring it – another hour gone. The second dump actually opened in my analysis tool. Unfortunately it was a bit hard to tell what the memory leak was with just one dump. I would need multiple dumps and compare them to see which objects are actually growing over time. This procedure took several hours. At the end I knew my top classes based on instance count but I had no real answer on the actual leak.”

Improve the process from hours to minutes

… continue the story on the dynaTrace Community Portal

Comments

  1. Best Web Design Company says:

    If memory is leaked then everything will be lost and it would cause danger to the production servers.

  2. It looks pretty strange we talk about memory leaks in java where memory allocation and de allocation is handled by Java Garbage Collectors. What I make out of this discussion is that your object which are functionally dead holds reference somewhere in your application and preventing garbage collector to collect it and some times its collection classes which holds these references , I would suggest use of WeakHashMap for building cache etc which normally holds java objects and prevent them from garbage collection.

    Thanks
    How Garbage collection works in Java

  3. A memory leak, in computer science (or leakage, in this context), occurs when a computer program consumes memory but is unable to release it back to the operating system. In object-oriented programming, a memory leak happens when an object is stored in memory but cannot be accessed by the running code.

Comments

*


− two = 1