I'm asking this from an Android perspective, but this should apply to RxJava in general.
As a best practice, should my view always dispose of even short lived Completable
, Single
, Maybe
and terminating Observable
Rx types that should terminate in short order, but could be still be executing when the user closes the view? I'm aware that when the Rx chain terminates, it is disposed but this could potentially occur sometime after the view is closed.
For example, a Single
that's performing an HTTP GET. The call will complete, but it may be after the view destroyed, temporarily preventing garbage collection.
And if a CompositeDisposable
is used to collect such Disposable
s in a long-lived view, I would think that care should be taken to clear()
or otherwise remove these Disposable
s regularly to prevent unbounded growth in the size of CompositeDisposable
?