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 leaking MainActivity #465

Merged
merged 1 commit into from
Oct 2, 2020
Merged

Fix leaking MainActivity #465

merged 1 commit into from
Oct 2, 2020

Conversation

vbuberen
Copy link
Collaborator

@vbuberen vbuberen commented Oct 2, 2020

📷 Screenshots

Screenshot 2020-10-02 at 14 27 01
Screenshot 2020-10-02 at 14 26 32

📄 Context

Recently saw a leak reported by LeakCanary and investigated the reason. In some cases Room database initialises with activity context instead of application and it leads to leaks.

📝 Changes

  • Replaced this with applicationContext in BaseActivity to provide proper Context object.
  • Renamed params to avoid confusion on which Context is required.
  • Updated LeakCanary to 2.5.

🚫 Breaking

Nothing

🛠️ How to test

Just launch sample app and try to play around with the app to see if LeakCanary reports something.

⏱️ Next steps

Probably, we could redo the way repositories initialisation happen. But it is not the top priority now.

@vbuberen vbuberen added bug Something isn't working enhancement New feature or improvement to the library labels Oct 2, 2020
@vbuberen vbuberen merged commit 2f9c21a into develop Oct 2, 2020
@vbuberen vbuberen deleted the fix/memory_leak branch October 2, 2020 14:02
@vbuberen vbuberen added this to the 3.3.1 milestone Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or improvement to the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants