Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix forever growing cancellable Manager
A long lived CancellableManagerProvider could easily end up with very many “cancelled” Cancellable in it’s internal CancellableManager because this is only cleared when the Provider itself is cancelled. This can cause huge memory leaks in some cases, for example in the DebounceProcessor Since there is only ever one “not cancelled” CancellableManager provided by the CancellableManagerProvider, there is actually no need to keep the previously provided, now cancelled, CancellableManager. We now simply use the internalCancellableManagerRef. Also took the oportunity to make cancelPreviousAndCreate hopefully atomic be exposing and using getAndSet on AtomicReference
- Loading branch information