Skip to content
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 memory leaks. #32

Open
AnuragThePathak opened this issue Oct 28, 2021 · 10 comments
Open

Fix memory leaks. #32

AnuragThePathak opened this issue Oct 28, 2021 · 10 comments
Assignees
Labels

Comments

@AnuragThePathak
Copy link
Owner

AnuragThePathak commented Oct 28, 2021

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
Copy link

@AnuragThePathak i got this, assign to me

@AnuragThePathak
Copy link
Owner Author

Done.

@Devendra34
Copy link
Contributor

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

@AnuragThePathak
Copy link
Owner Author

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

You went wrong means?

@Devendra34
Copy link
Contributor

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
Copy link
Owner Author

AnuragThePathak commented Oct 30, 2021

@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
Copy link
Contributor

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
Copy link
Owner Author

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
Copy link
Owner Author

@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
Copy link
Owner Author

AnuragThePathak commented Nov 1, 2021

@Devendra34 are you clear why memory leak is occurring?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants