Android 版本是否有最小堆大小? [英] Is there a minimal heap size for Android versions?

查看:16
本文介绍了Android 版本是否有最小堆大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

许多帖子都谈到了 Android 堆大小,到目前为止,我发现最大堆大小的唯一共同点是它至少为 16MB,但这是自 API 3 以来的限制.对于使用更多的内存,人们会建议使用 NDK 或任何超出正常"Android 开发的东西.

Many posts have talked about Android heap size, and so far what I've found out is that the only common thing about max heap size is that it's at least 16MB, but that was the limit ever since API 3. For using more memory, people would suggest to use the NDK or anything that is beyond the "normal" Android development.

是否有任何 Android 版本要求设备具有更大的堆大小,以便我可以开始假设更大的堆大小并停止如此便宜的内存?

Is there any Android version that has a requirement from the devices to have a larger heap size, so that I could start assuming a larger one and stop being so cheap on memory?

清单中是否也有关于大堆标志(来自 API 11 - 蜂窝)的要求,或者是设备甚至可能忽略它的模糊请求?

Is there also a requirement about the flag of the large heap (from API 11 - honeycomb) inside the manifest, or is it a vague request that the device might even ignore it?

只是 Android 硬件这些年来有了很大的改进,但我们仍然需要如此便宜的内存,即使设备现在有超过 1GB 的内存.奇怪的是,我们不能要求操作系统为我们提供特定数量的堆大小并保证我们不会再使用它.

It's just that the Android hardware has improved so much over the years, yet we still need to be so cheap on memory even though devices now have more than 1GB of ram. And it's weird that we can't ask from the OS to get us a specific amount of heap size and promise it that we won't use any more of this.

推荐答案

ok,我终于找到了答案(感谢 this发布) :

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

所有 android 版本(包括 5 个)的最低限度是 16MB.

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

可以在此处阅读每个 android 版本的要求:

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

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

您可以通过打开 CDD 文件并搜索运行时兼容性"(或旧版本的虚拟机兼容性")来阅读它们.另外,您可以通过搜索内存和存储"找到最小的 RAM 要求,但我认为这只是系统本身的要求.

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.

因此,例如,在 4.0.3 - 5 上,最小堆大小为:

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

  • 16MB:小/正常使用 ldpi/mdpi,或大使用 ldpi
  • 32MB:使用 tvhdpi/hdpi 小/正常,或使用 mdpi 大
  • 64MB:使用 xhdpi 的小/正常,或使用 tvdpi/hdpi 的大,或使用 mdpi 的 xlarge.
  • 96MB:400dpi 的小/普通,或 tvhdpi/hdpi 的超大
  • 128MB:小/正常使用 xxhdpi,或大使用 xhdpi
  • 192MB:小/正常,560dpi,大(400dpi),或 xlarge(xhdpi).
  • 256MB:使用 xxxhdpi 的小/正常,或使用 xxhdpi 的大
  • 288MB:400dpi 的超大
  • 384MB:560dpi 大,或 xxhdpi 超大
  • 512MB:xxxhdpi 大
  • 576MB:560dpi 的超大
  • 768MB:xlarge 与 xxxhdpi

我找不到 3.x 版本的最小堆大小,但它可能与 4.0.3 相同.

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

对于 2.1 - 2.3 ,最小堆大小为:

for 2.1 - 2.3 , the minimal heap size is :

屏幕被归类为中等或低密度必须配置 Dalvik 以分配至少 16MB 的内存到每个应用程序.具有分类为屏幕的设备实现高密度或超高密度必须配置 Dalvik 来分配每个应用程序至少有 24MB 的内存.注意设备实现可能会分配比这些数字更多的内存.

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.

含义:

  • 中等屏幕或 ldpi - 16MB
  • hdpi 或 xhdpi - 24MB

我找不到 1.6 版的最小堆大小,但它可能与 2.1 版相同.

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

此外,我不知道大堆标志应该为每个 android 版本(自 3.0 起)做什么.

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

这篇关于Android 版本是否有最小堆大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆