Original article: http://www.ziyouku.com/archives/android-applications-to-modify-the-default-maximum-memory-value.html
The default maximum memory size of Android applications is 16 Mb. Some applications may experience memory overflow, for example:
Error/androidruntime (264): Java. Lang. outofmemoryerror: bitmap size exceeds VM budget
In addition to checking the correction code, you can also consider modifying the default maximum memory value of the android application.
There are two ways to modify the default maximum memory of an application:
1. modify the code. It is applicable to self-Compiling and burning machines:
When the application allocates memory, it calls Dalvik/Vm/alloc/heapsource. the dvmtrackexternalallocation () method in C, and then calls the externalallocpossible () method. This method requires the size of the current heap used (composed of currentheapsize and HS-> externalbytesallocated) in addition, the size of the memory to be allocated again cannot exceed the maximum memory value of the heap. If it exceeds the value, an error is returned.
The maximum memory of a heap is determined in two places:
1) In Dalvik/Vm/init. C
Gdvm. heapsizemax = 16*1024*1024; // spec says 75% physical mem
2) In frameworks/base/CORE/JNI/androidruntime. cpp
Property_get ("Dalvik. VM. heapsize", heapsizeoptsbuf + 4, "16 m ");
Therefore, the solution is to increase the default 16 m in the above two points, such as 32 m.
2. modify the configuration file. It is applicable to versions after the machine is installed.
Modify or add the configuration item Dalvik. VM. heapsize = 32 m in/system/build. Prop.