AnuragThePathak / News-Feed-App

Get news from the world.
Apache License 2.0
4 stars 9 forks source link

Fix memory leaks. #32

Open AnuragThePathak opened 3 years ago

AnuragThePathak commented 3 years ago

Memory leaks are occurring in almost all fragments because of having non-nullable members.

You just have to handle memory leak due to adapter members inside all the fragment classes.

dhruvnagarajan commented 3 years ago

@AnuragThePathak i got this, assign to me

AnuragThePathak commented 3 years ago

Done.

Devendra34 commented 3 years ago

I'm interested in the discussion as well. Want to learn where I went wrong

AnuragThePathak commented 3 years ago

I'm interested in the discussion as well. Want to learn where I went wrong

You went wrong means?

Devendra34 commented 3 years ago

Using the Leak Canary library, I found there were some memory leaks in the app. But I was unable to fix them, so I mentioned that if in my newly added code, if there is anything wrong that is causing memory leak, then I want to understand it well

AnuragThePathak commented 3 years ago

@Devendra34 Well. Have you noticed how we are using the property binding and _binding in case of fragments? If you try to know why so you'll get to know reason behind memory leak.

Devendra34 commented 3 years ago

the way how we use this _bindings and all were guided on official docs of ViewBinding in Fragments. So, official docs won't be giving examples that contain a memory leak

AnuragThePathak commented 3 years ago

the way how we use this _bindings and all were guided on official docs of ViewBinding in Fragments. So, official docs won't be giving examples that contain a memory leak

But google is not a search engine which only shows results from official doc only.

AnuragThePathak commented 3 years ago

@dhruvnagarajan I have fixed the memory leak because of CustomTabsIntent.Builder().build() Now you just fix the leak because of adapter property. Btw I as a part of learning thought of implementing what I learnt and hence made some changes and CustomTabsIntent.Builder().build() got fixed. If you have any improvement suggestions then it's always welcomed.

AnuragThePathak commented 3 years ago

@Devendra34 are you clear why memory leak is occurring?