2014-06-17 3 views
7

우리는 작은 아바타부터 큰 전체 화면 이미지에 이르기까지 모든 이미지를로드하는 데 Picasso를 사용하고 있으며 매일 10 명의 활성 사용자 당 1 개의 오류가 발생합니다. Picasso 캐시가 채워지지만 자체적으로 유지해야한다는 것을 이해합니다.피카소 OutOfMemoryError를 생성합니다

Google의 기록에 따르면 고급형 기기 (Galaxy S4)에는 큰 전체 화면 이미지 (1080x1920)와 큰 아바타 (720x720)를로드 할 때 가끔씩 작은 오류 메시지 (135x135)를로드 할 때 이러한 오류가 자주 발생합니다.

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) 
+0

어댑터에 사용하고 있습니까? – Michael

+0

앱 전체에서이 오류가 발생합니다. ListAdapters PagerAdapters 및 일반 레이아웃 – nathanielwolf

+0

앱 전체에 Picasa의 자신 만의 싱글 톤 인스턴스를 사용하고 있습니까? – Michael

답변

1

나는이 같은 문제를 했어 임시 해결 방법 중 하나가 지금

<application 
    ... 
    android:largeHeap="true"> 

을, 나는 (어쩌면 내가 부족을 검색 한) 또 다른 해결책을 발견하지 않았습니다. 그러나 많은 사람들이 피카소와 OOM을 가지고 있습니다.

0

이미지를로드 할 때 fit()로 전화 하시겠습니까? 나는 이것이 내 문제 였다는 의심이 든다. 나는 이미지를 피카소와 함께 샘플링했다고 생각했지만 아직도 그렇게 말할 필요가있다.