-
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
fix: Remove click listeners to remove memory leaks #1766
fix: Remove click listeners to remove memory leaks #1766
Conversation
app/src/main/java/org/fossasia/openevent/general/event/EventViewHolder.kt
Outdated
Show resolved
Hide resolved
Rather than doing this, just remove koin scoping please These changes are too much and are not required in other apps |
I will remove Koin Scope. But should I keep the part where setting recyclerView adapter equals to null in other fragments in onDestroyView()? Leak Canary also find leaks in other fragments with the same adapter-recyclerView problem mentioned above. |
Honestly, that's a workaround, not a fix. We should try to find out the root cause of the leaks and fix it for the non koin adapters where leak canary is showing leaks. It may be because of nested viewholders or click listeners in adapters |
@iamareebjamal please take the look at this article as it faces the same problem as we are and please give me some advice on which solution should I go for
|
I'll take a look over the weekend. |
@iamareebjamal Have you taken a look at the blog post? |
Yes, the blog post is simply telling the problem. I'll analyse the app today to tell what can be the fix |
Memory leaks are due to click listeners. Please remove them onDestroyView |
Detail: - Clear click listener inside adapter Fixes: #1705
updated |
Detail:
Further description: https://stackoverflow.com/questions/35520946/leak-canary-recyclerview-leaking-madapter.
To be honest, I don't completely understand the problem and the memory leak in here, but this fix does really improve the app as it is faster in my device and leak canary doesn't find any leaks. So please correct me if there is anything wrong or give me further explanations.
Fixes: #1780