Monday, January 16, 2012

Android Application Performance Improvement (using DDMS-Traceview/MAT tool): Part-3

DDMS - Viewing heap usage for a Process/Application
DDMS allows you to view how much heap memory a process is using. This information is useful in tracking heap usage at a certain point of time during the execution of your application. Also, you can invoke garbage collection, which enables the collection of heap data.
In DDMS, Devices tab is on left side from where you can select the device and the process running for your application and then, you can see the various log reports under different tabs on the right side.

Open the application in Eclipse which you want to analysis the performance.
Select DDMS from the Eclipse

On running the application, you can analyse the heap memory usage as well. In DDMS, after the selecting application process, select Heap tab from the right side panel.

In the Devices tab, select the process that you want to see the heap information for. Click the Update Heap button to enable heap information for the process as shown in the below image.


You can see total Heap size, Allocated & Free memory, percentage usage and no of objects. Also, the distribution of heap memory size and count is available in different types of objects like, free, data object, class objects, 1-byte array, 2-byte array etc. 
In the Heap tab, click Cause GC to invoke garbage collection, which enables the collection of heap data.
When the operation completes, you will see a group of object types and the memory that has been allocated for each type. You can click Cause GC again to refresh the data.
Click on an object type in the list to see a bar graph that shows the number of objects allocated for a particular memory size in bytes.
In Bar graph of Allocation count per size, you can analyse which size of objects are maximum/minimum in the application.
The performance of your application can be improved in terms of heap allocations to the objects.
Note: The next part of this post will cover the analysis by using a powerful tool Eclipse MAT. Keep an eye!! J

1 comment:

  1. Facebook is one of the best social media site which will help you to increase your website visibility as well as Brand awareness.

    ReplyDelete