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 - 父级设置了相对定位。子元素设置了绝对定位。子元素中包含了浮动的table,这个时候高度不能自适应。2. docker容器呢SSH为什么连不通呢?3. docker images显示的镜像过多,狗眼被亮瞎了,怎么办?4. node.js - npm init无法一直回车。到version就卡主不动了5. docker api 开发的端口怎么获取?6. docker网络端口映射,没有方便点的操作方法么?7. golang - 用IDE看docker源码时的小问题8. dockerfile - 为什么docker容器启动不了?9. debian - docker依赖的aufs-tools源码哪里可以找到啊?10. docker start -a dockername 老是卡住,什么情况?
