程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> xutils3.0-用Xutils3.0加載圖片也出現內存溢出。。。?咋解決

xutils3.0-用Xutils3.0加載圖片也出現內存溢出。。。?咋解決

編輯:編程解疑
用Xutils3.0加載圖片也出現內存溢出。。。?咋解決

12-29 20:38:53.460 1024-1024/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: android.ye.fashioncircle, PID: 1024
java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack trace available
12-29 20:38:53.545 1568-1568/? E/QSEECOMD:: Listener: index = 0, hierarchy = 0
12-29 20:38:53.545 1568-1568/? E/QSEECOMD:: Init dlopen(librpmb.so, RLTD_NOW) is failed....
12-29 20:38:53.545 1568-1568/? E/QSEECOMD:: ERROR: RPMB_INIT failed, shall not start listener services
12-29 20:38:54.316 21890-21959/? E/anti: anti once
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] Runtime aborting...
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] Aborting thread:
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] "xTID#9" prio=5 tid=35 Native
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] | group="" sCount=1 dsCount=0 obj=0x32c1ed60 self=0xa0d98700
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] | sysTid=1101 nice=0 cgrp=default sched=0/0 handle=0x961fc930
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] | state=R schedstat=( 963313700 614145661 1024 ) utm=84 stm=12 core=1 HZ=100
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] | stack=0x960fa000-0x960fc000 stackSize=1038KB
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] | held mutexes= "abort lock"
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #00 pc 00370e01 /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiPKcPNS_9ArtMethodEPv+160)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #01 pc 0035046f /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+150)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #02 pc 00333827 /system/lib/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+26)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #03 pc 00333abf /system/lib/libart.so (_ZN3art7Runtime5AbortEv+562)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #04 pc 000f45fb /system/lib/libart.so (_ZN3art10LogMessageD2Ev+2226)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #05 pc 0025aa4f /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1550)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #06 pc 0025adfd /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+64)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #07 pc 000fd1d1 /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+32)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #08 pc 001022e5 /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE.constprop.95+5072)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #09 pc 00105fbb /system/lib/libart.so (_ZN3art8CheckJNI8ThrowNewEP7_JNIEnvP7_jclassPKc+438)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #10 pc 000075e3 /data/app/android.ye.fashioncircle-1/lib/arm/libwebpbackport.so (_ZN7_JNIEnv8ThrowNewEP7_jclassPKc+6)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #11 pc 000079b9 /data/app/android.ye.fashioncircle-1/lib/arm/libwebpbackport.so (Java_android_backport_webp_WebPFactory_nativeDecodeFile+332)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #12 pc 0000051d /data/app/android.ye.fashioncircle-1/oat/arm/base.odex (android.graphics.Bitmap android.backport.webp.WebPFactory.nativeDecodeFile(java.lang.String, android.graphics.BitmapFactory$Options)+112)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #13 pc 0000023d /data/app/android.ye.fashioncircle-1/oat/arm/base.odex (android.graphics.Bitmap android.backport.webp.WebPFactory.decodeFile(java.lang.String, android.graphics.BitmapFactory$Options)+80)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #14 pc 002b0b71 /data/app/android.ye.fashioncircle-1/oat/arm/base.odex (android.graphics.Bitmap org.xutils.image.ImageDecoder.getThumbCache(java.io.File, org.xutils.image.ImageOptions)+820)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #15 pc 002afe49 /data/app/android.ye.fashioncircle-1/oat/arm/base.odex (android.graphics.drawable.Drawable org.xutils.image.ImageDecoder.decodeFileWithLock(java.io.File, org.xutils.image.ImageOptions, org.xutils.common.Callback$Cancelable)+1404)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #16 pc 0055a9eb /data/app/android.ye.fashioncircle-1/oat/arm/base.odex (android.graphics.drawable.Drawable org.xutils.image.ImageLoader.prepare(java.io.File)+334)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #17 pc 0055accd /data/app/android.ye.fashioncircle-1/oat/arm/base.odex (java.lang.Object org.xutils.image.ImageLoader.prepare(java.lang.Object)+104)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #18 pc 00540181 /data/app/android.ye.fashioncircle-1/oat/arm/base.odex (java.lang.Object org.xutils.http.HttpTask.doBackground()+1572)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #19 pc 0028487b /data/app/android.ye.fashioncircle-1/oat/arm/base.odex (void org.xutils.common.task.TaskProxy$1.run()+774)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #20 pc 00283cfb /data/app/android.ye.fashioncircle-1/oat/arm/base.odex (void org.xutils.common.task.PriorityRunnable.run()+62)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] native: #21 pc 003cebf7 /data/dalvik-cache/arm/system@[email protected] (???)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] at android.backport.webp.WebPFactory.nativeDecodeFile(Native method)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] at android.backport.webp.WebPFactory.decodeFile(WebPFactory.java:58)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] at org.xutils.image.ImageDecoder.getThumbCache(ImageDecoder.java:661)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] at org.xutils.image.ImageDecoder.decodeFileWithLock(ImageDecoder.java:116)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] at org.xutils.image.ImageLoader.prepare(ImageLoader.java:375)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] at org.xutils.image.ImageLoader.prepare(ImageLoader.java:38)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] at org.xutils.http.HttpTask.doBackground(HttpTask.java:235)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] at org.xutils.common.task.TaskProxy$1.run(TaskProxy.java:62)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] at org.xutils.common.task.PriorityRunnable.run(PriorityRunnable.java:21)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
12-29 20:38:54.777 1024-1101/? A/art: art/runtime/runtime.cc:366] at java.lang.Thread.run(Thread.java:818)

最佳回答:


看一下源碼吧,你應該可以知道你得緩存存在什麼位置,大小是多少,在圖片顯示的地方try catch 一下,出現OOM情況清楚一下緩存,還有就是圖片如果加載過要調取緩存,這個問題在Imageloader中也出現過,也有人說過做一下內存管理,知道你們應用的內存大小,設置一下圖片的所有緩存大小,當達到臨界值的時候清除緩存,具體操作度娘一搜一大把。這樣做應該是可以的

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved