Method One:
How to view the memory limits of Android to apps
Each phone has a different limit on the app, and after all, we can use the following methods to see the maximum memory available to individual apps:
Execute command:
Shell Code
- ADB Shell Getprop | grep heap
- [Dalvik.vm.heapgrowthlimit]: [64m]
- [Dalvik.vm.heapsize]: [256m]
- [Dalvik.vm.heapstartsize]: [8m]
After entering the command, we look back to the above results.
[Dalvik.vm.heapstartsize]: [8m]: The starting heap=8m assigned to the process
[Dalvik.vm.heapgrowthlimit]: [64m]: Process can be assigned to a maximum of 64m
[Dalvik.vm.heapsize]: [256m]: The maximum amount of memory a single virtual machine can allocate =256m
Changing the above parameters can be modified in Build.prop
Build.prop in system, pull out to modify and then push back, reboot can
Reference:
http://su1216.iteye.com/blog/1663683
Method Two:
Execute while the program is running:
Java code
- int maxmemory = (int) (Runtime.getruntime (). MaxMemory ()/ 1024);
- LOG.D ("TAG", "Max memory is" + MaxMemory + "KB");
Divided by 1024 to get MB units, generally in 4.0 words are 64MB.
Android gain memory remaining size and total size