If you do have memory leaks in Java, let’s face it: spending hours trawling through thread dumps and profilers isn’t fun. And you don’t want to try a heap dump when the overhead could potentially bring down your app. But AppDynamics' Java memory leak detection can spot and flag leaking data structures:
AppDynamics automatically tracks the size and growth of Java Collections like HashMap, HashSets and ConcurrentLinkedQueues over time as data in your application is requested and persisted within JVM memory. AppDynamics uses intelligent algorithms to detect which Collections may potentially be leaking, and flags these Collections automatically so users can drill-down, and inspect the contents, to better understand what objects are being allocated, and how much memory these objects are consuming inside the Collection.
For example, in the above screenshot we can see that 109, 377 String objects have been allocated to a collection which occupies approximately 46MB of memory. Once we know what types of objects have been allocated, the next step is to determine what application code is allocating those objects so we can fix the memory leak. We can so this by using the "Access Tracking" feature as shown below, this shows which code path is performing object allocation (put()) on the leaking Collection. In the example below, its the collectionleak.dosomework() method which is adding to the HashSet Collection. We can also identify the business transaction "purchase order" is responsible for this code path so we can determine the real root cause and business impact of the memory leak.