简体   繁体   English

Galaxy s3 4.0.4中的内存不足错误

[英]Out of Memory Error in Galaxy s3 4.0.4

my application have grid view contain lot's of images and as from the Android documentation i understand that android improve the drawable garbage collection and the chance of out of memory is very low compared to os below 3.0 . 我的应用程序具有网格视图,其中包含很多图像,并且从Android文档中我了解到android改进了可绘制垃圾回收,并且与3.0以下的os相比,内存不足的可能性非常低。 Why still i got lot of out of memory in 4.0.4 only- Except this version i won't get single OOM after 3.0 为什么我仍然只在4.0.4中有很多内存不足-除此版本外,我在3.0之后将不会获得单个OOM

If you are using only drawable folder for ui. 如果您仅将可绘制文件夹用于ui。 you must be change your rule. 你必须改变你的规则。 Use drawable-xhdpi, drawable-hdpi drawable-mdpi bla bla bla. 使用drawable-xhdpi,drawable-hdpi drawable-mdpi bla bla bla。 Samsung galaxy s3 using drawable-xhdpi folder. 使用drawable-xhdpi文件夹的Samsung galaxy s3。 if your are using only drawable folder for images you will be get frag case memory warning and application give you error out of memory. 如果您只使用可绘制的文件夹来存储图像,则会收到碎片情况存储警告,并且应用程序会给您显示错误信息。 use memory management tool, change your approach to create user interface on android. 使用内存管理工具,更改在Android上创建用户界面的方法。 different screen size different drawable folder key subject 不同的屏幕尺寸不同的可绘制文件夹关键主题

Garbage collector improvement doesn't mean you can now load tonns of bitmaps, cause memory is still limited. 垃圾收集器的改进并不意味着您现在可以加载大量的位图,因为内存仍然有限。 I'd recommend you to learn this post carefully and follow those practices, then you'll be protected against OOM on any platform. 我建议您仔细学习这篇文章并遵循这些做法,然后在任何平台上都可以防止OOM。 Hope this helps. 希望这可以帮助。

If you are dealing with lots of images, better use lazy images loading. 如果要处理大量图像,最好使用惰性图像加载。
Here is a sample of images lazyloading in GridView. 是在GridView中延迟加载图像的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM