java - 使用glide加載圖片出現(xiàn)內(nèi)存溢出
問題描述
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)
誰有解決方法,發(fā)給我謝謝
問題解答
回答1:看這個log并不能發(fā)現(xiàn)什么,圖片加載出現(xiàn)oom是非常高概率的。請仔細判斷1)是否連續(xù)的加載了大圖而沒有及時回收?2)是否哪里內(nèi)存泄漏了?可以嘗試用LeakCanary檢查下內(nèi)存泄漏,或者用工具持續(xù)檢查內(nèi)存占用狀況
相關(guān)文章:
1. 關(guān)于nginx location配置的問題,root到底是什么2. angular.js - angularjs的自定義過濾器如何給文字加顏色?3. 關(guān)于docker下的nginx壓力測試4. docker鏡像push報錯5. angular.js - angular內(nèi)容過長展開收起效果6. 并發(fā)模型 - python將進程池放在裝飾器里為什么不生效也沒報錯7. python 怎樣用pickle保存類的實例?8. 大家好,請問在python腳本中怎么用virtualenv激活指定的環(huán)境?9. python2安裝失敗10. python的前景到底有大?如果不考慮數(shù)據(jù)挖掘,機器學(xué)習(xí)這塊?
