≡ Menu

Troubleshooting Java memory issues using AppDynamics – Part 2

In this part, let’s explore AppDynamics facilities for diagnosing Memory Leaks. AppDynamics provides two powerful tools to hunt down memory leaks.

  1. Automatic Leak Detection
  2. Objet Instance Tracking

Automatic Leak Detection

With Automatic Leak Detection enabled, Appdyanmics can capture objects that live longer than usual period – i.e long lived Collection objects that simply won’t get garbage collected. If your application is leaking memory, it is definitely one of these long-living, never-dying objects that cause the leak. Use the following procedure to make use of this tool.

  1. In AppDynamics Controller UI, locate the Node that you want to troubleshoot and click on ‘Memory’ tab
  2. Click on ‘Automatic Leak Detection’

  1. You must turn on Automatic Leak Detection by clicking on the ‘On’ button (if it was not enabled already)
  2. Click on ‘Start On Demand Capture Session”
  3. In the resulting Dialog box, enter the session duration and minimum collection age. I usually use 60 minutes and 2 minutes for this. Click OK.

  4. Sit back and wait. If your application has a memory leak indeed, you will see it soon on the screen
  5. You may have to update the minimum number of elements in a collection object to qualify for a leak suspect. You can configure this by navigating to Configure App Server Agent -> minimum-number-of-elements-in-collection-to-deep-size

Note: It is quite possible that Appdynamics does NOT find any potential leak but still you may be leaking memory in the application. It is my experience that you need several Heap dumps taken at various times to fully analyze your leak situation. Yes, memory leak sucks. But with persistent analysis, you can get to the bottom of it.

There is a yet another memory analysis tool in Appdynamics that can shed more light. It is ‘Object instance tracking’. That’s right, Appdynamics can track and report how many instances of a given class exist in Heap and their sizes – sweet hah? Let me show you how to do this in the next article.

Happy Leak Hunting!!

Comments on this entry are closed.