Skip to content

Memory Leak when subclassing CombineExtensionsProvider #78

@robdeans

Description

@robdeans

ℹ Please fill out this template when filing an issue.
All lines beginning with an ℹ symbol instruct you with what info we expect. You can delete those lines once you've filled in the info.

Please remove this line and everything above it before submitting.

What did you do?

On immi we have class HomeViewController: UIViewController that also conforms to CombineExtensionsProvider. We also subclass this for different devices by declaring final class PhoneHomeViewController: HomeViewController.

The issue is when using the performForLifetimeOf(self) Combine modifier, there appears to be a memory leak due to the binding being stored in multiple instances of cancellables

What did you expect to happen?

When subclassing with a CombineExtensionsProvider, I would expect all bindings to be released when self is deinitialized.

What happened instead?

Instead, bindings are causing a retain cycle presumably because they are stored in multiple places (the subclassed cancellables and the super-class cancellables)

Environment

FueledUtils version:
Xcode version:
Swift version:
Platform(s):
macOS version running Xcode:

Demo Project

Several PRs in immi have addressed this issue in various forms:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions