views:

25

answers:

1

How to pin point a memory leak in a heap dump using jhat/jvisualvm tool?

I have a heap dump of our application generated using jmap during an "OutOfMemoryError:Java Heap Space error". I used jhat to analyse the dump but the info is too huge and I could not find where the memory leak occurred.Please help me in pin-pointing the objects that caused memory leaks.

A: 

Visual VM will show you that the perm gen is filled, which means OOM error.

When you get that heap dump, you'll be able to see the object with the most instances. That should give you a clue as to the culprit.

duffymo
You can get OOME for plenty of reasons other than perm gen filling up. Most likely is the old generation filling up if using a generational GC. But also if garbage collection takes too long, etc.
dty
I cited one example among many. The point is that Visual VM will help identify all of them.
duffymo