什么是内存的应用程序可以使用的最大带宽? [英] What is the maximum amount of RAM an app can use?

查看:269
本文介绍了什么是内存的应用程序可以使用的最大带宽?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇这个问题,关于Android操作系统的的内存管理,所以我希望在这个主题相当详细的解答。

我想知道的:

  • 什么是内存的最高金额(在 /为 百分比总RAM的),一个Android应用程序(即不是一个系统的应用程序)可以使用吗?
  • 是否有各种不同的的Andr​​oid版本之间的差异
  • 是关于该设备的制造商有差异?

而最重要的是:

  • 在其中方面的因素是考虑到/ 这是什么取决于当涉及到确定多少RAM的应用程序可以使用(在运行时)<? / LI>

我迄今听到:

  • 在早期的设备有每个应用程序上限为16MB
  • 在更高版本的设备增加了24MB至32MB或

是什么让我很好奇:

这两个限制是非常低的。

我最近刚刚下载的 Android的任务管理器检查我的设备内存。我所注意到的是,也有使用40-50兆的RAM,这是obvioulsy比我们说32 MB的最高提及RAM使用更多的应用程序。那么如何计算其RAM的应用程序可以使用吗?这怎么可能,应用程序超过该限制?

此外,我注意到,我的崩溃与一些应用程序的 OutOfMemoryException异常使用30-40兆的时候。在另一方面,我有我的手机上运行的应用使用 100 MB多(我的一个朋友曾经开发了一个泄漏的应用程序:-))不崩溃。 因此,它显然也依赖于应用程序本身当涉及到确定多少RAM也不能幸免。这怎么可能?

感谢你提前为您的解释。

PS:我调试的RAM上的HTC One S采用768MB

解决方案
  

什么是最大内存量(以兆字节/为RAM总量的百分比)是一个Android应用程序(即不是一个系统的应用程序)可以使用吗?

这是由各个设备。 <一href="http://developer.android.com/reference/android/app/ActivityManager.html#getMemoryClass%28%29"><$c$c>getMemoryClass() ActivityManager 会给你的价值你的code为在运行设备。

  

是Android的版本之间有什么区别?

是的,只要操作系统的要求也逐年增加,而且设备必须适应相匹配。

  

是否有关于该设备的制造商不同?

是的,只要厂商制造设备,以及大小因器件而异。

  

其中方面的因素的考虑,当涉及到确定多少RAM的应用程序可以使用?

我不知道什么是面因素的意思。

  

早期的设备有每个应用程序上限为16MB;更高版本的设备增加了24MB至32MB或

这是对的。屏幕分辨率是一个显著的决定因素,因为大的分辨率意味着更大的位图,所以片剂和高分辨率的手机将趋向于具有更高的值尚未。例如,您将看到48MB堆设备,我不会感到惊讶,如果有值高于

  

这怎么可能,应用程序超过该限制?

您认为该应用程序的作者知道他(她)在做什么。考虑到<一href="http://stackoverflow.com/questions/2298208/how-to-discover-memory-usage-of-my-application-in-android/2299813#2299813">memory一个应用程序的使用是困难的核Android工程师,以确定,我不认为有问题的应用程序是必要提供特别精确的结果。

话虽这么说,天然code(NDK)不受堆限制。而且,由于Android 3.0,应用程序可以请求一大堆,一般在几百MB的范围,但是这对于大多数应用程序视为形式拙劣。

  

此外,我注意到,使用30-40兆字节,当我的崩溃与一个OutOfMemoryException的一些应用程序。

记住,Android的垃圾收集器是不是压缩垃圾收集器。唯一的例外确实应该是 CouldNotFindSufficientlyLargeBlockOfMemoryException ,但很可能认为太罗嗦了。 OutOfMemoryException异常意味着您无法分配你请求的数据块,不是说你已用尽你的堆完全。

I am quite curious about this question concerning the memory management of the Android operating system so I hope for a quite detailed answer on that topic.

What I would like to know:

  • What is the maximum amount of memory (in Megabytes / as percentage of the total RAM) that an Android application (that is not a system app) can use?
  • Are there any differences between the various different Android versions?
  • Are there differences concerning the manufacturer of the device?

And most importantly:

  • Which "side factors" are taken into consideration / what does it depend on when it comes to determining how much RAM an app can use (at runtime)?

What I have heard so far:

  • Early devices had a per-app cap of 16MB
  • Later devices increased that to 24MB or 32MB

What makes me very curious:

Both of these limits are very low.

I have just recently downloaded the Android Task Manager to check my devices RAM. What I have noticed is that there are applications using around 40-50 megabytes of RAM, which is obvioulsy more than the mentioned maximum RAM usage of let's say 32 MB. So how is it calculated which RAM an app can use? How is it possible that apps exceed that limit?

Furthermore, I noticed that some apps of mine crash with an OutOfMemoryException when using around 30-40 Megabytes. On the other hand, I have apps running on my phone using 100 MB and more (a friend of mine once developed a "leaking" app :-)) that do not crash. So it obviously also depends on the app itself when it comes to determining how much RAM can be spared. How is this possible?

Thank you in advance for your explaination.

PS: I am debugging on a HTC One S with 768Mb of RAM.

解决方案

What is the maximum amount of memory (in Megabytes / as percentage of the total RAM) that an Android application (that is not a system app) can use?

That varies by device. getMemoryClass() on ActivityManager will give you the value for the device your code is running upon.

Are there any differences between the Android versions?

Yes, insofar as OS requirements have increased over the years, and devices have to adjust to match.

Are there differences concerning the manufacturer of the device?

Yes, insofar as manufacturers manufacture devices, and the size varies by device.

Which "side factors" are taken into consideration when it comes to determining how much RAM an app can use?

I have no idea what "side factors" means.

Early devices had a per-app cap of 16MB; Later devices increased that to 24MB or 32MB

That's about right. Screen resolution is a significant determinant, as larger resolutions mean larger bitmaps, and so tablets and high-resolution phones will tend to have higher values yet. For example, you will see devices with 48MB heaps, and I wouldn't be surprised if there are values higher than that.

How is it possible that apps exceed that limit?

You assume that the author of that app knows what (s)he is doing. Considering that memory usage of an app is difficult for a core Android engineer to determine, I would not assume that the app in question is necessarily providing particularly accurate results.

That being said, native code (NDK) is not subject to the heap limit. And, since Android 3.0, apps can request a "large heap", usually in the hundreds of MB range, but that's considered poor form for most apps.

Furthermore, I noticed that some apps of mine crash with an OutOfMemoryException when using around 30-40 Megabytes.

Bear in mind that the Android garbage collector is not a compacting garbage collector. The exception really should be CouldNotFindSufficientlyLargeBlockOfMemoryException, but that was probably deemed too wordy. OutOfMemoryException means that you could not allocate your requested block, not that you have exhausted your heap entirely.

这篇关于什么是内存的应用程序可以使用的最大带宽?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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