首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >毕加索创作OutOfMemoryError

毕加索创作OutOfMemoryError
EN

Stack Overflow用户
提问于 2014-06-18 02:34:38
回答 2查看 948关注 0票数 9

我们正在使用毕加索在我们的应用程序中加载所有的图像,从小的头像到大的全屏图像,我们每天每10个活跃用户就会收到1个这样的错误。毕加索的缓存正在填满,但我们的理解是,它应该保持自己。

我们的日志表明,在高端设备(Galaxy S4)上加载大型全屏图像(1080x1920)和大型头像(720x720)时,这些错误最常见,但偶尔也会在小型头像(135x135)上发生。

代码语言:javascript
复制
com.couchsurfing.mobile.data.PicassoException: Error while loading image with Picasso
       at com.couchsurfing.mobile.data.DataModule$1.onImageLoadFailed(DataModule.java:158)
       at com.squareup.picasso.Picasso.complete(Picasso.java:374)
       at com.squareup.picasso.Picasso$1.handleMessage(Picasso.java:97)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:5419)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:525)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: java.lang.RuntimeException: ===============BEGIN PICASSO STATS ===============
Memory Cache Stats
  Max Cache Size: 19173961
  Cache Size: 17988408
  Cache % Full: 94
  Cache Hits: 228
  Cache Misses: 244
Network Stats
  Download Count: 131
  Total Download Size: 3375735
  Average Download Size: 25768
Bitmap Stats
  Total Bitmaps Decoded: 206
  Total Bitmap Size: 144932008
  Total Transformed Bitmaps: 160
  Total Transformed Bitmap Size: 40233240
  Average Bitmap Size: 703553
  Average Transformed Bitmap Size: 195306
===============END PICASSO STATS ===============

       at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:117)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
       at java.util.concurrent.FutureTask.run(FutureTask.java:234)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
       at java.lang.Thread.run(Thread.java:841)
       at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:394)
Caused by: java.lang.OutOfMemoryError
       at android.graphics.BitmapFactory.nativeDecodeStream(BitmapFactory.java)
       at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:623)
       at com.squareup.picasso.NetworkBitmapHunter.decodeStream(NetworkBitmapHunter.java:118)
       at com.squareup.picasso.NetworkBitmapHunter.decode(NetworkBitmapHunter.java:72)
       at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:144)
       at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:101)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
       at java.util.concurrent.FutureTask.run(FutureTask.java:234)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
       at java.lang.Thread.run(Thread.java:841)
       at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:394)
EN

回答 2

Stack Overflow用户

发布于 2015-04-21 17:34:36

我也遇到过同样的问题,其中一个临时解决方法是

代码语言:javascript
复制
<application
    ...
    android:largeHeap="true">

到目前为止,我还没有找到另一个解决方案(也许我搜索得还不够)。但很多人都对毕加索有好感。

票数 1
EN

Stack Overflow用户

发布于 2016-07-12 01:45:07

加载图片时调用fit()吗?我怀疑这是我的问题,我假设图像是用毕加索自己采样的,但你仍然需要告诉它这样做。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24270975

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档