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

Clean up any references to the binding class instance in the fragment's onDestroyView() #7

Open
AlexTrotsenko opened this issue Apr 17, 2020 · 1 comment

Comments

@AlexTrotsenko
Copy link

In Readme it's written, that

DataBinding-ktx is saving memory because of cleaning up the binding variable having the view tree after onDestroyView.

I see it's well aligned with note in official documentation:

Note: Fragments outlive their views. Make sure you clean up any references to the binding class instance in the fragment's onDestroyView() method.

But briefly looking though the code I was not able to find clean-up of the binding.

Could you please advice how clean-up is achieved? I am a bit anxious about keeping additional memory unintentionally.

@wada811
Copy link
Owner

wada811 commented Apr 20, 2020

Thank you for asking your question.

The binding is stored by View's tag. The view is released after onDestroyView. And the view's tag is also released. Therefore, the binding is clean-up.

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

No branches or pull requests

2 participants