Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strong reference to targetItem in LayoutItem can cause memory leak #6

Open
t089 opened this issue Aug 1, 2018 · 0 comments
Open

Strong reference to targetItem in LayoutItem can cause memory leak #6

t089 opened this issue Aug 1, 2018 · 0 comments

Comments

@t089
Copy link

t089 commented Aug 1, 2018

The LayoutItem tuple contains a strong reference to the targetItem view. This can cause a memory retain cycle if the view itself maintains a strong reference to the layout item tuple.

public typealias LayoutItem = (constraint: NSLayoutConstraint, targetItem: UIView)

Maybe a possible fix would be to make LayoutItem a final class with a weak reference to targetItem.

Of course the necessity of LayoutItem is questionable in the first place, because the layout constraint already has a unowned (!) reference to the two parties participating in the constraint (firstItem, secondItem).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant