-
Notifications
You must be signed in to change notification settings - Fork 551
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 when setting up Recycler/Adapter #1780
Comments
Reopening because there might be other reasons for memory leaks. Please check @anhanh11001 |
@liveHarshit can you also take a look at this issue as well, I'm not sure for now |
Sure 👍 |
@anhanh11001 @iamareebjamal What if we use data bindings for fragments instead of using |
It's not. The listeners are causing the memory leak. If you use the binding. binding and hence, the root view will get leaked |
Okay and leaking always starts with message |
Doesn't matter. It means that the fragment fragmentmanager is not null and thus leaked, leaking the fragment |
DiffCallBack could also be the cause? |
Just remove the listeners in onDestroyView |
or make it static? |
Then change the title to "Add more memory leaks" |
Click listeners are removed in #1766 But still, there are memory leaks with recycler adapters - |
These clearly show swipe refresh listener not being removed |
But it is set to null - |
Will see what's happening |
@liveHarshit I encountered a similar issue, rootview was leaking for me. Try removing the rootview, Im not sure about open-event's codebase but someone did code the fragments similar to EventsFragment.kt |
@adityastic will try |
Not a solution |
also set adapter to null
|
Tried, it worked. But Areeb said it is just a workaround, not a fix so it wasn't implemented.
|
@anhanh11001 It actually just prevents LeakCanary to report it as memory leak. It doesn't solve the memory leak |
Describe the bug
In most fragment, setting up RecyclerView and Adapter leads to memory leaks reported by Leak Canary
Screenshots
Additional context
#1705 related issue
Would you like to work on the issue?
Yes
The text was updated successfully, but these errors were encountered: