-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
Memory leaks in BlockingBlurController #89
Comments
Hm, that's weird. I'm removing this listener straight away after |
@Dimezis No, that method not called at all (I could remove it w/o any negative effect) |
Weird stuff. How does BlurView initialize the bitmap in this case? |
As I can see - deferBitmapCreation called only when measuredWidth and measuredHeight give us a zero sized downscaled image, probably in my case its not getting zero sized image (Correct if i'm wrong). if (isZeroSized(measuredWidth, measuredHeight)) {
deferBitmapCreation();
return;
} OS: Android 8.1 |
But if it wasn't called, there would be no leak :) Something similar to your approach would work, but I don't like using similar |
I'm sorry: I missed some important thing. It turned out that the deferBitmapCreation method called only on first few view bindings in RecyclerView Adapter. After that adapter reuses previously inflated views as it should be, without initializing new ones. Following logic we've initialized that views and listeners were removed - no leak shoud occur, but it occurs, although no new BlurController were created. So far I can not understand why there is a leak... |
Btw are you sure you don't have leaks anymore? Because essentially you're leaking it again by doing |
the massive memory leak Im experiencing in since I don't know why it was introduced, but removing all |
leak canary may report this as it may be GC'ed lazily but not every anonymous class is automatically an issue, despite leak canary (temporarily) reporting it. I wouldn't see that |
@DominuS-RU could you check if you still see leakage with patch it requires |
@DominuS-RU @masc3d Can confirm the patched version above doesn't have the leak. |
@Dimezis do you prefer pull request for this? |
@masc3d would really appreciate it |
Hello, @Dimezis
I'm using your librray in such way: Activity -> Fragment -> RecyclerView Item with blurred background.
So, when I replace fragment with recyclerview and blured items to another one I'm getting several leaks detected by LeakCanary.
screenshot #1
screenshot #2
screenshot #3
In my (and LeakCanary's) opinion the leak was caused by anonymous class in BlockingBlurController#deferBitmapCreation (read here about it)
I tried to remove it at all and as result no leaks detected and lower memory consumption achieved. So I can suggest to make that class static.
And call it from function like it:
This solution fixed memory leak for me.
Regards,
Alexey Egin.
The text was updated successfully, but these errors were encountered: