Memory Profiling

Effective memory management ensures optimized performance
from any application. The Memory node provides information about the
memory used by your application. It shows the number of objects, the method
that created them, the size of the objects and the status of the objects.
This information is presented in the form of charts and tables for easy
interpretation and clearly shows the high memory consumption areas of the
application.

The Memory views can be accessed from the Navigational Tree by clicking on the Memory Profiling node.

The types of Memory Reports generated by the AppPerfect Java Profiler are
explained below.

Class-Wise Allocations

The Packages/Classes tab provides a tabular report of the Live
objects and Garbage collected objects present within the profiled
application. The Packages/Classes tab is displayed on selecting
Class-Wise Allocations under the Memory node in the navigation tree.
You can see Allocation tree as well in the Allocation tree tab.

This table gives an indication of the most heavily used
objects and the amount of memory that they are consuming. It provides
information on the different Packages and the Classes present within them,
number of Live Objects, Size of the Objects, and number of Garbage Collected
Objects Size of the GC Objects, total number of Objects and total size of
Objects in bytes, created since the launch of the application. You can sort
the data based on any of the column headings so that data most relevant to
your analysis is shown.

To filter the data in the classes table in the Filter
on drop-down menu select any of the columns for filter is to be applied,
and also select the Not Equal to or Equal to option from the
drop-down menu. Once you have applied the filter and entered the details
click Filter. To clear the filtered data click Clear.

Method-Wise Allocations

Method-wise allocations shows the method details for the classes that have
been excecuted so far. You can see Allocation details and Allocation tree as well.

Allocation tree shows the allocation of the memory in the
heap. It shows a tree structure with many nodes. The first level of this tree
will show you the percentage of total objects allocated in the class
selected. At the second level the threads created by the application will be
shown and the total number of objects that were allocated by that thread. At
the next level you will have a series of nodes representing different
packages. This information can be useful to identify the proportion of memory
utilised by each method in the running threads.

The percentage allocation along with the Class Name and
Total Number of Allocations is displayed at the top of the allocation tree
and at every node of the Allocation Tree.

This can be interpreted as follows:

Total n alloc: This shows the total number of objects created
within that method and the methods that were called from within that
method.

Self n alloc: This shows the exact number of objects created
within the method itself.

The method and the class it belongs to is
displayed in the following format.class-name:
method-name() :
return-type
Within the ( ) the list of parameters
that the method takes are shown. Each parameter is shown in the following
format: fully-qualified-class;

The meaning of signatures used either in the parameter list or return
types are described in the table:

Garbage collection is the process of automatically freeing
objects that are no longer referenced by the application. Garbage collection
in short implies memory recycling of the objects. When a object is no
longer referenced by the program, the heap space it occupies must be recycled
so that the space is available for subsequent new objects. The garbage
collector determines which objects are no longer referenced by the program
and releases the heap space occupied by such unreferenced objects.

To start garbage collection click Garbage Collector in the toolbar or select
Run GC from the Project Menu. Once Garbage Collection is run, the garbage
collection report can be viewed. This Garbage Collection report shows all the
collected objects.

If the garbage collector fails to collects the unreferenced
objects you then have to check into your code and analyze if the objects
which have not been garbage collected are being reused or if they are still
holding some reference that is avoiding them to be garbage collected.

GC Charts

In the first table in this panel, you can see details such as the
description and the minimum, maximum, average and total for each of the
parameters listed in the table. The value shown in the minimum column is the
minimum value during one of the garbage collection invocations. Similarly,
the value shown in the maximum column is the maximum value during one of the
garbage collection invocations. Average is the average value for the
particular detail.

GC Memory Info

Garbage Collection memory chart provides details of the memory utilized
for Garbage collection. The Garbage collection memory chart is displayed on
selecting GC Browser under the Memory node in the navigation
tree. It is plotted with the time stamp on the X axis and the memory utilized
for garbage collection (in bytes) on the Y axis.

GC Time Info

Garbage Collection time chart provides details of the time
spent in Garbage collection. The Garbage collection time chart is displayed
on selecting GC Browser under the Memory node in the navigation
tree. It is plotted with the time stamp on the X axis and the time spent in
garbage collection (in milliseconds) on the Y axis.

GC Objects Info

Garbage Collection objects chart provides details of the object instances
moved and freed during profiling. The Garbage collection objects chart is
displayed on selecting GC Browser under the Memory node in the
navigation tree. It is plotted with the time stamp on the X axis and the
objects instances moved and freed during garbage collection (in number of
instances) on the Y axis.

GC Surviving Generations

Garbage Collection surviving generations chart provides details of the gc cycles object has
survived during profiling. The Garbage collection surviving generations chart is
displayed on selecting GC Browser under the Memory node in the
navigation tree. It is plotted with the time stamp on the X axis and the surviving
generations count on the Y axis.

GC Details

The details listed in the table are given below:

Start Time: The time at which a particular
instance of garbage collection started.

Time spent in
GC: The time spent in garbage collection in milliseconds.

Memory
Reclaimed: The memory reclaimed in bytes due to garbage collection
invocation is shown here.

Objects freed:
The number of object freed during the garbage collection invocation.

Objects moved:
The number of object moved during the garbage collection invocation.

If there are too
many objects being garbage collected, it indicates that there may be
unnecessary objects being created by the application. This increases memory
consumption as well as time spent on Garbage Collecting the objects which may
cause potential performance issues. Please check your application for issues
like creating objects in a loop and so on.