-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We are getting Out of memory exceptions in firebase #2057
Comments
Hi @geek2driod , Sorry for the slow response, there are some general things you can check to help reduce the number of OutOfMemoryErrors you get.
|
Hello @erikandre Thanks for your response. We are using fresco in RecyclerView and in custom views. `private void setupImage(final SimpleDraweeView simpleDraweeView, final Uri uri) {
Following code is written in custom views: `ImageRequest imageRequest = ImageRequest.fromUri(url);
That's the only code snippet of fresco we are using in our whole app. Please guide us that the above code is right or wrong. |
In the layout for your recyclerView items, how do you define the width and height of the SimpleDraweeView? Also, what does setTeam2Flag(bitmap) do? |
Hello @erikandre , I am defining SimpleDraweeView in my RecyclerView items layout as follows:
setTeam2Flag method is used to keep the WeakReference of bitmap and invalidate the custom view. Following is the code snippet of this method:
Thanks, |
Since you have a fixed hight and aspect ratio, could you not set the resize option without the need to the layout listener? The usage of com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber is not correct (but I don't think it could case the issue you're experiencing). If you check the documentation for BaseBitmapDataSubscriber, you will see that is says
I recommend that you either switch to using a BaseDataSubscriber and manage the ClosableReference or keep using BaseBitmapDataSubscriber and instead copy the bitmap. |
@erikandre Thankyou for your suggestions. I have changed my code as you said. I hope these changes will reduces the Out of memory exceptions. |
Seems like this has been fixed. If not, please let us know! |
Hello, We switch image caching library from Glide to Fresco. Fresco is much better then Glide but unfortunately we are getting out of memory exceptions in our Firebase crash reporting console.
Please guide us how to resolve this exception:
Exception java.lang.OutOfMemoryError: Failed to allocate a 391260 byte allocation with 239306 free bytes and 233KB until OOM
dalvik.system.VMRuntime.newNonMovableArray (VMRuntime.java)
android.graphics.Bitmap.nativeCreate (Bitmap.java)
android.graphics.Bitmap.createBitmap (Bitmap.java:942)
android.graphics.Bitmap.createBitmap (Bitmap.java:913)
android.graphics.Bitmap.createBitmap (Bitmap.java:880)
com.facebook.imagepipeline.memory.BitmapPool.h ()
com.facebook.imagepipeline.memory.BitmapPool.a ()
com.facebook.imagepipeline.memory.BasePool.get ()
com.facebook.imagepipeline.bitmaps.ArtBitmapFactory.createBitmapInternal ()
com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory.createBitmap ()
com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory.createBitmap ()
com.facebook.fresco.animation.bitmap.BitmapAnimationBackend.drawFrameOrFallback ()
com.facebook.fresco.animation.bitmap.BitmapAnimationBackend.drawFrameOrFallback ()
com.facebook.fresco.animation.bitmap.BitmapAnimationBackend.drawFrameOrFallback ()
com.facebook.fresco.animation.bitmap.BitmapAnimationBackend.drawFrame ()
com.facebook.fresco.animation.backend.AnimationBackendDelegate.drawFrame ()
com.facebook.fresco.animation.backend.AnimationBackendDelegateWithInactivityCheck.drawFrame ()
com.facebook.fresco.animation.drawable.AnimatedDrawable2.draw ()
com.facebook.drawee.drawable.ForwardingDrawable.draw ()
com.facebook.drawee.drawable.ForwardingDrawable.draw ()
com.facebook.drawee.drawable.ScaleTypeDrawable.draw ()
com.facebook.drawee.drawable.FadeDrawable.drawDrawableWithAlpha ()
com.facebook.drawee.drawable.FadeDrawable.draw ()
com.facebook.drawee.drawable.ForwardingDrawable.draw ()
com.facebook.drawee.generic.RootDrawable.draw ()
android.widget.ImageView.onDraw (ImageView.java:1179)
android.view.View.draw (View.java:16486)
android.view.View.updateDisplayListIfDirty (View.java:15416)
android.view.View.getDisplayList (View.java:15438)
android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3697)
android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3676)
android.view.View.updateDisplayListIfDirty (View.java:15376)
android.view.View.getDisplayList (View.java:15438)
android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3697)
android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3676)
android.view.View.updateDisplayListIfDirty (View.java:15376)
android.view.View.getDisplayList (View.java:15438)
android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3697)
android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3676)
android.view.View.updateDisplayListIfDirty (View.java:15376)
android.view.View.getDisplayList (View.java:15438)
android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3697)
android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3676)
android.view.View.updateDisplayListIfDirty (View.java:15376)
android.view.View.getDisplayList (View.java:15438)
android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3697)
android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3676)
android.view.View.updateDisplayListIfDirty (View.java:15376)
android.view.View.getDisplayList (View.java:15438)
android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3697)
android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3676)
android.view.View.updateDisplayListIfDirty (View.java:15376)
android.view.View.getDisplayList (View.java:15438)
android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3697)
android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3676)
android.view.View.updateDisplayListIfDirty (View.java:15376)
android.view.View.getDisplayList (View.java:15438)
android.view.ViewGroup.recreateChildDisplayList (ViewGroup.java:3697)
android.view.ViewGroup.dispatchGetDisplayList (ViewGroup.java:3676)
android.view.View.updateDisplayListIfDirty (View.java:15376)
The text was updated successfully, but these errors were encountered: