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?
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?
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
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: