Skip to content

OperatorReplay leaks its subscribers #4228

Closed
@ntoskrnl

Description

@ntoskrnl

We use replay(1) a lot in our Android projects. All subscriptions are kept in CompositeSubscription and, of course, we always clear it when we don't need it anymore.

Even though we unsubscribe from observable, subscriber won't get collected by GC, because it is referenced by OperatorReplay, which prevents Activity or Fragment from being garbage collected. We do need to keep observable alive and resubscribe to it from new Activity instance, but now we can't use replay() as all our Activities are leaked.

Right now we downgraded back to 1.1.5. Alternatively, one can use publish() with behavior subject to work around this issue. I believe the issue was introduced in one of the latest versions of the library (perhaps 1.1.6, not sure though).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions