If you create classes with a life cycle of nothing more than a lookup, that's fine. Otherwise, you should avoid this.
If you use such a structure, make sure that you do not have references to instances of the inner class when viewing is not needed. Then the GC will collect everything and there will be no memory leaks.
Jin35 source share