A Memory Leak happens when an application unintentionally holds on to object references that are no longer required. These unintentional object references prevent the built-in garbage collection mechanism from freeing up the memory consumed by these objects.

## Pre-Requisite

- To initiate the memory leak analyzer, the Cavisson agent should be running on the target instance.

## Select Target

- In the memory leak analyzer window, you have to select the Tier, Server and Instance from their respective drop-down in order to take the memory leak.
- To start a Memory Leak Analyzer, you have to select the instance which you want to run and then click on the Start Memory Leak Analyzer button. Once clicked, the Memory Leak Analyzer popup will open.

## Memory Leak Analyzer

In the memory leak analyzer window, you can see the following information which are listed below:

### Settings

In settings, you can apply the following two settings which are listed below:

- Sample Interval in sec (s): You have to provide the time interval for which the samples are to be collected in Seconds.

## Global Action Icons

- Once you have provided all the required details in their respective fields, you have to click on the Apply button to apply the settings.
- If you want to reset the instance count, then you have to click on the Reset icon to reset the instance count and size deltas
- If you want to refresh the data without storing the memory leaks sample, then you have to click on the Refresh icon.
- If you want to pause updating data but want the analysis to keep running in the background, then you have to click on the Pause icon.
- Once you click on the Pause icon, to resume the trend analysis, click on the Start Trend Analysis of Memory Leaks.
- If you want to completely stop the memory leak trend analysis, then you have to click on the Stop Trend Analysis icon.

## Tabular View

Under the tabular view, you will be able to see a detailed list of all the objects currently consuming the memory on the selected instance. This is an extremely useful view in terms of identifying areas of optimization. Following details are provided for each object under the tabular view:

- Object Type: The specific class of the objects being analyzed (e.g., org.jruby.RubyString, java.lang.String, etc.)
- Growth Rate (KB/s): The rate at which memory associated with a particular object type is increasing over time, measured in kilobytes per second. High growth rates for specific object types can indicate potential memory leaks.
- Heap Usage (in %): The percentage of the total heap memory that is occupied by instances of this object type. This helps identify which objects are consuming the most memory relative to the total available.
- Size (MB): The total memory size occupied by all instances of this object type, measured in megabytes.
- Delta Size (KB): The change in memory consumption by this object type between two measurement points, measured in kilobytes. Positive values indicate growth.
- Count: The total number of instances of this object type present in memory.
- Delta Count: The change in the number of instances between two measurement points. Consistently positive delta counts can indicate objects being created but not properly garbage collected.

## Global Action Icon

- Search Box: Users can search values across all columns in the table. Simply type the keyword, and the table will instantly filter results to display only the matching rows.
- Column Filter: Users can use the Column Filter icon to filter values by specific columns.
- Manage Columns: Users can use the Manage Column icon to show or hide columns and rearrange their sequence.
- Download: Users can use the Download icon to export table data in PDF, Word, CSV, and Excel formats.

## Chart View:

The chart view displays a pie chart showing distribution of the top 10 objects in terms of heap usage. For e.g. object type “byte[]” taking 20% of heap memory, object type “org.jruby.RubyString” taking 5.8% of heap memory etc.

## Compare:

Under the compare section, you will be able to view the heap memory percentage taken by different object types. You can define the no.of samples you want to take for comparison and the sample interval count in seconds under the settings section.

For e.g. if you enter 2 under no.of samples and 60 seconds under the sample interval count then 2 samples will be taken after 60 seconds and you will be able to view the comparison in form of a bar chart with different colored bars coming for the two different samples as defined above.