Notifications
Clear all

[Solved] How do I track down memory leaks in my module implementation?

1 Posts
2 Users
3 Reactions
1,313 Views
1
Topic starter

We suspect memory leaks are present in our implementation. What tools are available? How do we set these up?

1 Answer
2

Firstly, you should make sure the -XX:+HeapDumpOnOutOfMemoryError option is set for your jvm. This will ensure that if/when you get an OutOfMemoryError, a heap will be dumped that we can analyze. This option is set by default in our run.bat & wrapper.conf so this shouldn't be something you have to set yourself.

However, what if it's not reaching the turning point, but you can see the memory is consistently climbing? Another thing you can do is use the JMX method "forceOutOfMemoryError" under Admin=DTB Admin. This will create a bunch of objects of type ForceOutOfMemoryObject until the heap runs over, then the previous option ensures that heap gets dumped.

Once you have a heap, you can then look through the heap using Eclipse MAT. By looking at the types of objects and their counts, you can usually get a sense of which processes you have might be leaking objects. (You would obviously ignore any instances of ForceOutOfMemoryObject in this heap.)

But what if that doesn't help either? You can also use a profiler. We have a licensed copy of JProfiler at \dfwnas05installersJprofiler. You can use JProfiler on your local machine to carefully measure memory deltas as you're running various processes.