Skip to content
Advertisement

OutOfMemory Exception – how does VisualVM help locate the memory leak with heapdump file?

I’ve been testing my webapp locally on my pc and monitoring it with VisualVM. I recently also started using JMeter, as it was suggested that I should do some load testing since I suspected that I have a slow memory leak somewhere.

Today my webapp finally threw the OutOfMemory exception. I had the HeapDumpOnOutOfMemoryError and HeapDumpPath params set in case this ever happened. A heap dump file was generated.

I opened this file (java_pid2760.hprof) in VisualVM, and honestly, I don’t understand how I’m supposed to be able to pinpoint the culprit of this memory leak…

How do you use VisualVM to analyze a heap dump and find the class/instance that is generating the memory leak?

Advertisement

Answer

Here’s a couple of links I found helpful when debugging memory leaks:

http://olex.openlogic.com/wazi/2009/how-to-fix-memory-leaks-in-java/

http://www.ibm.com/developerworks/rational/library/05/0816_GuptaPalanki/

Edit:

You might also want to try: http://rejeev.blogspot.com/2009/04/analyzing-memory-leak-in-java.html

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement