Skip to content

Fix leaking MainActivity#465

Merged
vbuberen merged 1 commit into
developfrom
fix/memory_leak
Oct 2, 2020
Merged

Fix leaking MainActivity#465
vbuberen merged 1 commit into
developfrom
fix/memory_leak

Conversation

@vbuberen

@vbuberen vbuberen commented Oct 2, 2020

Copy link
Copy Markdown
Collaborator

📷 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 requested review from MiSikora and cortinico October 2, 2020 11:43
@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