开发者

Dalvik Memory Allocation - How to change the default limits?

I am currently considering to develop an application for processing of images captured by the camera of mobile phones using the Android OS. Before I make the decision to go forth, I have done some research and found out there are some complaints regarding the limits of the memory allocated by the Dalvik VM, which seem to be limiting to applications that require manipulation and processing of images. Which limits should i have in mind if i would have to process for example 3 photos taken with the camera, in my process, applying filters, transforms and other types of mathematical operations开发者_Python百科?

I would like to know if it is possible to change the default value of memory allocated by the Dalvik VM for each application (this default is of 16 MB), in any way, using the Android 1.6 OS. Has anybody looked into this that can help me out please?

I have also read in the Android 2.1 compatibility definition document (available here: http://static.googleusercontent.com/external_content/untrusted_dlcp/source.android.com/pt-PT//compatibility/android-2.1-cdd.pdf ) that it is possible to change the allocation of memory by the Dalvik VM from 16 MB to 24 MB or even a bigger amount if it is necessary, but it is not mentioned anywhere how this can be done.

If someone has looked into those issues before and could give me some help or hints, it would be greatly appreciated. Thank you.


On a usual device you cannot change the heap-limits of your application. They are hardcoded by the OEM. If you are developing for some device of which you have full control, you can modify Dalvik startup scripts to allow more heap space.


You may change this by changing vm.heapSize item in the avd's config.ini. For example, you may write

vm.heapSize=64

in config.ini. If there is no such item, you may add a new one.

However, please notice that vm.heapSize may be overridden by the skin. There is a hardware.ini in the skin's path, and it contains default settings of vm.heapSize and hw.ramSize which may override your value. To workaround this problem, you may set

skin.path=720x1280
skin.name=720x1280

The numbers are not important, it must be in the (width)x(height) form.


You can change the default global heap size via adb shell setprop, for instance:

   setprop dalvik.vm.heapsize 128m
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜