Memory leak ArrayList java
Custom Memory Structures for JavaThis page describes how to monitor custom memory structures for Java. Show AppDynamics automatically tracks long-lived Java collections (HashMap, ArrayList, and so on) with Automatic Leak Detection.To track specific classes, you can use the Custom Memory Structures capability in the Controller UI. You can use this capability to monitor a custom cache or other structure that is not a Java collection. For example, you may have a custom cache or a third-party cache such as Ehcache. In a distributed environment, caching can easily become a prime source of memory leaks. In addition, custom memory structures may or may not contain collections of objects that would be tracked using automatic leak detection. Monitoring custom memory structures with the Java Agent can result in increased CPU utilization. AppDynamics recommends you enable memory structure monitoring on a short-term basis only while troubleshooting or in pre-production environments. To configure custom memory structures, ensure custom memory structures are supported in your JVM environment. SeeJVM Support.
Custom Memory Structures and Memory LeaksTypically custom memory structures are used as caching solutions. In a distributed environment, caching can easily become a source of memory leaks. AppDynamics helps you to manage and track memory statistics for these memory structures. AppDynamics provide visibility into:
Automatic Leak Detection Versus Monitoring Custom Memory StructuresAutomatic leak detection captures memory usage data for all map and collection libraries in a JVM session. However, custom memory structures may not contain all collection objects. For example, you may have a custom cache or a third-party cache such as Ehcache for which you want to collect memory usage statistics. Using custom memory structures, you can monitor any custom object created by the app and the size data can be traced across JVM restarts.Automatic leak detection is typically used to identify leaks, while custom memory structures are used to monitor large coarse-grained custom cache objects. The following provides the workflow for configuring, monitoring, and troubleshooting custom memory structures. You must configure custom memory structures manually.
To identify custom memory structures:
AppDynamics captures the top 1000 classes, by instance count. Identify Potential Memory LeaksStart monitoring memory usage patterns for custom memory structures. An object is automatically marked as a potentially leaking object when it shows a positive and steep growth slope. The Memory Leakdashboard provides the following information:
The Custom Memory Structures dashboard provides the following information:
After the potentially leaking collections are identified, start the diagnostic session. Diagnose Memory LeaksOn the Custom Memory Structures dashboard, select the class name to monitor and clickDrill Down. Isolate Leaking CollectionsUse Content Inspection to identify to which part of the application the collection belongs. It allows monitoring histograms of all the elements in a particular memory structure. Start a diagnostic session on the object and then follow these steps:
Access TrackingUse Access Tracking to view the actual code paths and business transactions accessing the memory structure. Start a diagnostic session on the object and then follow these steps:
|