I have studied your doubts, and I confirm my answer:
This will happen if you declare singletonInstance static. For your business, singletonInstance is just an instance of SingletonClass. Remember that there is no such thing as a โstatic instanceโ, an instance is just an object of this class, which makes it static, the way you declare it in your scope. For MyActivity, singletonInstance is not static, even if inside SingletonClass you are referring to the same object / instance, and there it is declared as static.
Thus, your activity can be cleared by the GC without any problems. I have a similar implementation on Android, and it includes a Service, it worked for hundreds of hours without any memory or performance issues ...
Hello
source share