Hi Jan,

Good observation. I never put much thought into that but now let’s discuss. First we establish what is memory leak. Memory leak is when an object that has no further use is being kept from garbage collection, right?.

I’m assuming you are thinking that since component is static anybody using it via application class will keep the application class from being garbage collected. But if anyone is using this static component, means that application class cannot be garbage collected since it is present throughout the life of an app. Hence I think memory leak shouldn’t be a problem here.
Also, keeping static component in application isn’t probably the best way to solve this. So if you are aware of a better solution, share!

Software Engineer @Zomato. Passionate about tech, music, movies, gaming, coffee and food! Find my writing at https://www.chaddha.me/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store