java - 使用glide加载图片出现内存溢出
问题描述
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)
谁有解决方法,发给我谢谢
问题解答
回答1:看这个log并不能发现什么,图片加载出现oom是非常高概率的。请仔细判断1)是否连续的加载了大图而没有及时回收?2)是否哪里内存泄漏了?可以尝试用LeakCanary检查下内存泄漏,或者用工具持续检查内存占用状况
相关文章:
1. javascript - 怎么实现让 div 里面的 img 元素 中心居中, 如下示例图2. html5 - 使用angular中,图片上传功能中选择多张图片是怎么实现的?有什么好的思路吗?3. 微信开放平台 - ios APP能不能打开微信然后通过微信跳转到指定的URL?4. javascript - vue引入样式的问题5. javascript - 移动端一个小效果6. javascript - vue+iview upload传参失败 跨域问题后台已经解决 仍然报403,这是怎么回事啊?7. Mac环境下QT编译MySQL驱动屡次失败?如何?8. php - 微信开发验证服务器有效性9. javascript - 如何做出pc网站随鼠标滚动动态出现效果10. javascript - nodejs调用qiniu的第三方资源抓取,返回401 bad token,为什么
