zetbaitsu / Compressor

An android image compression library.
7.08k stars 963 forks source link

java.lang.OutOfMemoryError #70

Open ght199266 opened 7 years ago

ght199266 commented 7 years ago

FATAL EXCEPTION: main java.lang.OutOfMemoryError at android.graphics.BitmapFactory.nativeDecodeStream(Native Method) at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:650) at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:389) at id.zelory.compressor.ImageUtil.decodeSampledBitmapFromFile(ImageUtil.java:49) at id.zelory.compressor.ImageUtil.compressImage(ImageUtil.java:27) at id.zelory.compressor.Compressor.compressToFile(Compressor.java:60) at id.zelory.compressor.Compressor.compressToFile(Compressor.java:56) at com.lly.testdemo.ImageCompressor$1.onClick(ImageCompressor.java:61) at android.view.View.performClick(View.java:4211) at android.view.View$PerformClick.run(View.java:17267) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4898) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773) at dalvik.system.NativeStart.main(Native Method)

ght199266 commented 7 years ago

Samsung Gt-19300 android 4.1.2

IsaiasSantana commented 7 years ago

@ght199266 This can happen. Bitmaps can very easily exhaust an app's memory budget. Maybe to fix this, could use the glid library to load the images. Avoiding manage memory and disk caching.

zhaozeyx commented 6 years ago

image

Is it a problem? the bitmap decoded is not recycled, and I have no idea how to recycle the bitmap

Duna commented 6 years ago

Bitmap .Recycle()

On Thu, 15 Mar 2018, 04:02 Demon, notifications@github.com wrote:

[image: image] https://user-images.githubusercontent.com/4213414/37440415-927862ee-2837-11e8-86e7-f7ac7f47c22f.png

Is it a problem? the bitmap decoded is not recycled, and I have no idea how to recycle the bitmap

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/zetbaitsu/Compressor/issues/70#issuecomment-373235430, or mute the thread https://github.com/notifications/unsubscribe-auth/ADn9ws2zCje7Q6J4cs338exZFktExyvZks5tecufgaJpZM4OPWVj .