Thursday, 22 September 2016

How to approach a memory leak

Steps to take to get a picture of the memory dump:
  • Get a historic look at the logs.
  • Open the heap dump with VisualVM
  • Look at the objects that using the most memory.
  • Query those objects for information using QQL.

If there are lots of objects then you need to distinguish if the object have the same type of information or they are referenced from the same type of object. It will give you a clearer picture of what type of object is causing the problem and where it is coming from.

QQL has the ability to count objects based on a criteria. For example, you query to count the number of hashmaps that have a certain size.

I have added a OQL project to GitHub. It has advanced OQL queries which have been tested with a sample program in the project. I have expanded the queries past what is in the visualvm OQL userguide.

https://visualvm.java.net/oqlhelp.html

No comments:

Post a Comment