java - 使用glide加載圖片出現(xiàn)內(nèi)存溢出
問(wèn)題描述
Pending exception java.lang.OutOfMemoryError: Failed to allocate a 1125012 byte allocation with 784248 free bytes and 765KB until OOMcom.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream, android.graphics.BitmapFactory$Options, com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool, int, int, int, com.bumptech.glide.load.DecodeFormat) (Downsampler.java:217)at android.graphics.Bitmap com.bumptech.glide.load.resource.bitmap.Downsampler.decode(java.io.InputStream, com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool, int, int, com.bumptech.glide.load.DecodeFormat) (Downsampler.java:151)at com.bumptech.glide.load.engine.Resource com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(java.io.InputStream, int, int) (StreamBitmapDecoder.java:50)at com.bumptech.glide.load.engine.Resource com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(java.lang.Object, int, int) (StreamBitmapDecoder.java:19)at com.bumptech.glide.load.engine.Resource com.bumptech.glide.load.resource.bitmap.ImageVideoBitmapDecoder.decode(com.bumptech.glide.load.model.ImageVideoWrapper, int, int) (ImageVideoBitmapDecoder.java:39)
誰(shuí)有解決方法,發(fā)給我謝謝
問(wèn)題解答
回答1:看這個(gè)log并不能發(fā)現(xiàn)什么,圖片加載出現(xiàn)oom是非常高概率的。請(qǐng)仔細(xì)判斷1)是否連續(xù)的加載了大圖而沒(méi)有及時(shí)回收?2)是否哪里內(nèi)存泄漏了?可以嘗試用LeakCanary檢查下內(nèi)存泄漏,或者用工具持續(xù)檢查內(nèi)存占用狀況
相關(guān)文章:
1. boot2docker無(wú)法啟動(dòng)2. java - SSH框架中寫(xiě)分頁(yè)時(shí)service層中不能注入分頁(yè)類3. 老師,按tab鍵不起作用怎么回事4. 關(guān)于docker下的nginx壓力測(cè)試5. node.js - antdesign怎么集合react-redux對(duì)input控件進(jìn)行初始化賦值6. javascript - sublime快鍵鍵問(wèn)題7. python - django的model字段在保存的時(shí)候做預(yù)處理怎么辦?8. angular.js - Angular開(kāi)發(fā)的單頁(yè)面應(yīng)用,如何正確地實(shí)現(xiàn)在微信里的網(wǎng)頁(yè)授權(quán)和調(diào)用js sdk9. python - for循環(huán)print怎樣才能輸出csv呢10. html - input中radio為什么多選

網(wǎng)公網(wǎng)安備