Home  >  Q&A  >  body text

Java - memory overflow occurs when loading images using glide

Pending exception java.lang.OutOfMemoryError: Failed to allocate a 1125012 byte allocation with 784248 free bytes and 765KB until OOM
com.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)

谁有解决方法,发给我谢谢

PHP中文网PHP中文网2736 days ago1086

reply all(1)I'll reply

  • 滿天的星座

    滿天的星座2017-05-17 10:09:15

    You can’t find anything by looking at this log. There is a very high probability of OOM when loading images.
    Please judge carefully
    1) Are large images loaded continuously but not recycled in time?
    2) Is there a memory leak somewhere?
    You can try to use LeakCanary to check for memory leaks, or use tools to continuously check memory usage

    reply
    0
  • Cancelreply