0

I've started to debug my software using visualVM. I only started to get familliar with this software.

I have memory leak. I found sth that is suspected, but dont know what to make of it.

What is the next step?

enter image description here

user502967
  • 327
  • 1
  • 3
  • 13
  • 1
    It looks like you have a JDBC connection holding a HashMap which contains 180Mb of data. Click on the JDBC connection and try to understand from the name of the field holding the big map what it is supposed to contain. – Flavio Feb 11 '13 at 12:55
  • it's impossible to understand from it. DOES SOMEONE HAS TRICKS FOR THAT? – user502967 Feb 11 '13 at 17:39

2 Answers2

2

This is the way I use Java visualVM to quickly trace memory leaks.

First setup breakpoint or pause in your code at places you want to inspect.

Perform Heap Dumps of your program, use "show in instances view" to view instances in detail for classes you suspect to leak (i.e. obviously too much instances in memory).

Then identify one instance of that class that should have been collected. In the "references" panel, you can see all the objects that refer to your class, right click on "this" and select "nearest GC root", this will show you what references prevent the class from being collected by the GC.

This way you can quickly identify where is the wrong reference and modify your program accordingly to avoid the leak.

Good luck, it's actually very interesting task and if you are a beginner you will learn a lot about how the JVM works

Julien
  • 1,302
  • 10
  • 23
0

I do not know anything about your application but I would suspect the memory leak can be traced back to a HashMap. Values often accumulate in maps (for caching...). Also have a look at these similar posts:

Community
  • 1
  • 1
Christophe Roussy
  • 16,299
  • 4
  • 85
  • 85