如何解决清除Android中的Picasso缓存而无需跳过的简单方法
我使用Picasso将相机中的图像加载到回收站视图中,然后将其上传到服务器中。 我的毕加索(Picasso)往往会给我一个OOM(内存不足)错误,我正在寻找一种清除缓存的方法,而不必跳过它或禁用缓存。
Starting a blocking GC Alloc
10-08 01:00:08.928 11110-11110/com.example E/PicassoUtil$getPicasso: Picasso error! Uri: /n4e/services/rest/images/63726073
java.lang.RuntimeException: ===============BEGIN PICASSO STATS ===============
Memory Cache Stats
Max Cache Size: 76695844
Cache Size: 75497472
Cache % Full: 99
Cache Hits: 0
Cache Misses: 33
Network Stats
Download Count: 0
Total Download Size: 0
Average Download Size: 0
Bitmap Stats
Total Bitmaps Decoded: 29
Total Bitmap Size: 91226112
Total Transformed Bitmaps: 0
Total Transformed Bitmap Size: 0
Average Bitmap Size: 3145728
Average Transformed Bitmap Size: 0
===============END PICASSO STATS ===============
at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:180)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:411)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 3145740 byte allocation with 1040648 free bytes and 1016KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:635)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:611)
at com.squareup.picasso.BitmapHunter.decodeStream(BitmapHunter.java:142)
at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:217)
at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:159)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:411)
10-08 01:00:09.038 11110-17072/com.example I/art: Clamp target GC heap from 526MB to 512MB
10-08 01:00:09.038 11110-17072/com.example I/art: Alloc concurrent mark sweep GC freed 20897(582KB) AllocSpace objects,1(20KB) LOS objects,0% free,510MB/512MB,paused 6.959ms total 194.480ms
10-08 01:00:09.038 11110-17072/com.example I/art: Forcing collection of SoftReferences for 3MB allocation
10-08 01:00:09.038 11110-17072/com.example I/art: Starting a blocking GC Alloc
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。