Panadol Chong
Panadol Chong

Reputation: 1903

How to analyze heapdump with common leak suspect

The application hitting slowness issue and generate some heapdump file, the heapdump file is 1.2GB, and I need to run my ha456.jar using 8.4GB RAM only can open the heapdump.

Before this, when I analyze the heapdump, I will try to see the Bigger LeakSize and check for the Leak Suspect value, and I can see that which class or which method of my application holding the big memory. And then I will try to fix the code so that it can run with better performance.

For this time, I cant really get the point that which module/method of my application causing the out of memory issue. The following are some of my screen shot of my HeapAnalyzer:

enter image description here

enter image description here

enter image description here

For me, its just common class, for example java/lang/object, java/lang/Long, or java/util/HashMap. I cant really know which method of my application causing the out of memory.

Appreciate your advise on how to analyze on this.

Upvotes: 1

Views: 1186

Answers (2)

Renato
Renato

Reputation: 2157

Finding memory leak is always very difficult for anyone in front of the code, let alone from so far. So I can only give you some suggestions:

  1. you got an heap dump, filter by your own objects and analyze who creates the most numerous
  2. run your application and monitor it with VisualVM, use the application a little bit and then force a GC run... 9 times out of 10 the objects whose number does not decrease significantly or do not completely reset are your memory leak

Upvotes: 2

Salim
Salim

Reputation: 2178

This maybe happening due to a lot of records are read from somewhere like database, queue which is of type Long. There could be a cartesian join or something of that sort. Once i had a ton of strings causing oom and the culprit was a logger accumulating logs.

A couple of thoughts- When you get oom error trace that back to the suspect method. Get thread dump and see which threads are active and what they are executing.

Upvotes: 0

Related Questions