In Android, devices with different sizes of RAM will be allocated different initial running memory. Higher-resolution devices are also sure to require more memory than lower-resolution devices. How much is allocated, this can be viewed in your device/system/build.prop files , there are instructions. (Below is the information of my test equipment LG 720P resolution 4.7 inch phone)
<span style= "White-space:pre" ></span>dalvik.vm.heapstartsize = 8m dalvik.vm.heapsize = 256m dalvik.vm.heapgrowthlimit= 70m
Heapgrowthlimit is a memory limit for a common application ,OKwith Activitymanager.getlargememoryclass ()method is obtained.
Heapstartsize is the initial memory, the application with the use, the memory is constantly automatically increased, will slowly reach the maximum memory limit.
The Androidmanifest.xml application tag has a android:largeheap= "true" property, and when set to True, you can request more memory from the device, The default is False. Even if this is set to true, it will not be allocated in unlimited amounts, and will still be reported as Oom error when a certain threshold is reached. So Google does not recommend this to do, as a development we should first consider how to reduce memory or reduce the use of incremental memory, rather than blindly to increase the memory space.
In the development, in order to avoid oom, we should try to optimize the algorithm logic, using the official recommended methods, such as 2.3 commonly used weakreference and softreference, to the present LRUCache class and so on,
good applications should have a reasonable and clear memory allocation, rather than random to create new objects, constantly open the page does not close the old page, or a lot of resources to do the cache and so on. Timely release of memory, and before caching some of the image resources through a similar getlargememoryclass () method to know in advance the application of the maximum memory, so as to reasonably preset the size of the cache, to effectively avoid the oom problem.
Android memory allocation to your app