
例如,我有一个内存缓存,我将其限制设置为5 MB.如果在一个设备上,我的应用程序只能获得8 MB的内存来播放,另外一个是24 MB,我想调整内存缓存的上限以利用或多或少的内存.
有没有办法解决这个问题,数额甚至有所不同?
解决方法 是的,最大堆大小因设备而异.您可以通过调用getMemoryClass()来检查设备的每个应用程序的近似值. Returns the approximate per-application memory class of the current device. This gives you an IDea of how hard a memory limit you should impose on your application to let the overall system work best. The returned value is in megabytes; the baseline AndroID memory class is 16 (which happens to be the Java heap limit of those devices); some device with more memory may return 24 or even higher numbers.
更改应用程序堆大小的唯一内置方法是在AndroIDManifest.xml中设置androID:largeHeap =“true”.这通常会将堆大小从48增加到128.请记住,这种方法只适用于3.x平板电脑.否则,您将需要一个根深蒂固的设备,这显然不是您希望作为开发人员的依据.
总结以上是内存溢出为你收集整理的每个android进程有多少内存?全部内容,希望文章能够帮你解决每个android进程有多少内存?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)