Is there a minimal heap size for Android versions?

独自空忆成欢 提交于 2019-11-27 14:30:45
android developer

ok, i've finally found the answer (thanks to this post) :

the bare minimal for all versions of android (including 5) , is 16MB.

the requirements for each of the android versions can be read about here:

http://source.android.com/compatibility/downloads.html

you can read about them by opening the CDD files and searching for "Runtime Compatibility" (or "Virtual Machine Compatibility" for old versions). also, you can find the minimal RAM requirement by searching for "Memory and Storage", but i think it's only the requirement for the system itself.

so, for example, on 4.0.3 - 5 the minimal heap size is:

  • 16MB: small/normal with ldpi/mdpi, or large with ldpi
  • 32MB: small/normal with tvhdpi/hdpi, or large with mdpi
  • 64MB: small/normal with xhdpi, or large with tvdpi/hdpi, or xlarge with mdpi.
  • 96MB: small/normal with 400dpi, or xlarge with tvhdpi/hdpi
  • 128MB: small/normal with xxhdpi, or large with xhdpi
  • 192MB: small/normal with 560dpi, or large with 400dpi, or xlarge with xhdpi .
  • 256MB: small/normal with xxxhdpi, or large with xxhdpi
  • 288MB: xlarge with 400dpi
  • 384MB: large with 560dpi, or xlarge with xxhdpi
  • 512MB: large with xxxhdpi
  • 576MB: xlarge with 560dpi
  • 768MB: xlarge with xxxhdpi

I can't find the minimal heap size for versions 3.x but it's probably the same as 4.0.3 .

for 2.1 - 2.3 , the minimal heap size is :

Device implementations with screens classified as medium- or low-density MUST configure Dalvik to allocate at least 16MB of memory to each application. Device implementations with screens classified as high-density or extra-high-density MUST configure Dalvik to allocate at least 24MB of memory to each application. Note that device implementations MAY allocate more memory than these figures.

meaning:

  • medium screen or ldpi - 16MB
  • hdpi or xhdpi - 24MB

i can't find the minimal heap size for version 1.6 , but it's probably the same as 2.1 .

also, i can't find out what should the large-heap flag do for each of the android versions (since 3.0) .

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!