First, by Dumpsys to value
1、adb shell dumpsys meminfo
Obtain information on all processes of memory and the total memory, free memory, used memory, and other information.
2, want to get detailed information about a process memory, followed by the package name or pid.
adb shell dumpsys meminfo pakagename or Pid
3, focusing on field
(1) Native / Dalvik information of Heap
It gives each of the memory allocation Java JNI layer and the layer, if you find this value has been growing, the program represents a memory leak may occur.
Dalvik Heap heap memory is often said, Dalvik Heap not exceed the maximum limit; exceeds the maximum limit of a single program memory, it may appear OOM (out of memory).
(2) Total of PSS information
PSS- Proportional Set Size of physical memory actually used (prorated shared libraries occupy memory), this value is your real application memory size occupied by this information, you can easily determine which programs accounted for the phone memory is relatively large.
Second, with / system / xbin / procrank intuitive tool value
1、adb shell procrank
Three, top
1、top -d 1 | grep packageName adb shell top -d 1 | grep packageName
Fourth, on a single application memory footprint issues
# View the largest single application memory limit
adb shell getprop|grep heapgrowthlimit
Allocated memory after the initial application startup #
adb shell getprop|grep dalvik.vm.heapstartsize
# Single largest java virtual machine memory limits
adb shell getprop|grep dalvik.vm.heapsize
应用如果不想在 dalvik heap达到heapgrowthlimit限制的时候出现OOM,需要在 Manifest中的application标签中声明 android:largeHeap=“true”,声明后应用 dalvik heap 达到heapsize的时候才会出现OOM!
注:设备的不一样 最大内存限制也可能不一样