Installation/Configuration:
You can use another tool to test the APP performance of the mobile client. This is the DDMS tool (Dalvik Debug Monitor Service) in the android Development Kit. First, let's talk about the installation of the android development kit:
1. First install JDK 1.5 or a later version.
2. After JDK is installed, You need to download and install the Android SDK, that is, android-sdk-windows. The compressed package is about 55 MB.
3. Decompress android-sdk-windows and place it in the root directory of drive C. Set the system variable path to C: \ android-sdk-windows \ tools.
Start:
1. You can enter ddms during running.
2. You can also start ddms. bat in the C: \ android-sdk-windows \ tools directory.
Connection:
1. Use the data cable to connect to the Android mobile phone and confirm that the mobile phone is in "USB debugging" mode.
1) press the "Menu" key on your phone and select "Setting" in the pop-up Menu )";
2) Select "application ";
3) Select "Unknown Source" on this interface and select "development ";
4) Check "USB debugging" and "keep awake ";
2. In the left-side dialog box of ddms, the APP processes opened by the mobile phone are displayed. If not displayed, you can connect multiple times or try another mobile phone.
Operation:
The premise is to open the app of the mobile client we want to analyze (the APK program is available on the Internet)
1. Click the process you want to monitor, such as the system_process process;
2. Click the "Update Heap" icon in the top row of the selected Devices View Interface;
3. Click "Cause GC" in the Heap view;
4. In the Heap view, the details of the memory usage of the selected process are displayed.
Analysis:
How can we know whether our program has the possibility of Memory leakage. Here, you need to pay attention to a value: In the Heap view, there is a Type called data object, that is, the data object, that is, a large number of class Type objects in our program. In a row of data object, there is a column named "Total Size", whose value is the Total memory of all Java data Objects in the current process. Generally, the size of this value determines whether memory leakage exists. You can judge this as follows:
A) constantly operate on the current application, and observe the Total Size value of the data object;
B)Under normal circumstances, Total SizeThe value is always in a limited range.That is to say, because the code in the program is good and the object is not recycled by garbage collectionAlthough we continuously generate many objects during operationsGCThese objects are recycledMemory usage will reach a stable level;
C) if the Code does not release the object reference, the Total Size value of the data object will not be significantly reduced after each GC, as the number of operations increases, the value of Total Size increases, and the process is killed until the maximum number is reached.
D) The system_process process is used as an example. In my testing environment, the Total Size of the data object occupied by the system_process process will normally be 2.2 ~ 2.8, and when the value exceeds 3.55, the process will be killed.
Reference: http://hi.baidu.com/2012jasonhao/item/27fafb0c014a5ac42f4c6b25