lopspower / CircularImageView

Create circular ImageView in Android in the simplest way possible
Apache License 2.0
1.95k stars 413 forks source link

Possible memory lake #61

Closed pishguy closed 6 years ago

pishguy commented 8 years ago

i get this error

java.lang.OutOfMemoryError: Failed to allocate a 9000012 byte 
allocation with 3137632 free bytes and 2MB until OOM

at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:831)
at android.graphics.Bitmap.createBitmap(Bitmap.java:808)
at android.graphics.Bitmap.createBitmap(Bitmap.java:728)
at android.graphics.Bitmap.createBitmap(Bitmap.java:653)
at com.mikhaellopez.circularimageview.CircularImageView.cropBitmap
(CircularImageView.java:206)
tiger1990 commented 8 years ago

I get the same issue java.lang.OutOfMemoryError: Failed to allocate a 456988 byte allocation with 198696 free bytes and 194KB until OOM at dalvik.system.VMRuntime.newNonMovableArray(Native Method) at android.graphics.Bitmap.nativeCreate(Native Method) at android.graphics.Bitmap.createBitmap(Bitmap.java:947) at android.graphics.Bitmap.createBitmap(Bitmap.java:918) at android.graphics.Bitmap.createBitmap(Bitmap.java:838) at android.graphics.Bitmap.createBitmap(Bitmap.java:763) at CircularImageView.cropBitmap(CircularImageView.java:264) at

pishguy commented 8 years ago

@tiger1990 I have to remove this library on my project

behelit commented 7 years ago

Same issue, any alternative libraries?

Rainer-Lang commented 7 years ago

You could have a look here: https://github.com/TangoAgency/avatar-view Please let me know if this lib is really an alternative. Thanks.

lopspower commented 6 years ago

Fix on https://github.com/lopspower/CircularImageView/commit/227d12eb399ab18a54b06fd63f94b68d6d0493eb This memory leak comes from cropBitmap method. I removed it and I changed the technique to auto center crop image in view.