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

Fix retain cycle #30

Merged
merged 1 commit into from
Jun 6, 2016
Merged

Fix retain cycle #30

merged 1 commit into from
Jun 6, 2016

Conversation

bobspryn
Copy link
Member

@bobspryn bobspryn commented Jun 6, 2016

Noticed a retain cycle when using RxViewModel.

@bobspryn bobspryn mentioned this pull request Jun 6, 2016
@bobspryn
Copy link
Member Author

bobspryn commented Jun 6, 2016

Actually, still seeing the issue (though I'm pretty sure the change I made in this PR should still eliminate one retain cycle.)

Documenting the issue here: #31

@esttorhe
Copy link
Member

esttorhe commented Jun 6, 2016

😱 good catch @sprynmr

CirceCI has been off for quite some time (need to fix this).

I'll go ahead and merge this (giving that its true that this should take at least 1 retain cycle)

Thanks for the PR.

BTW. I'm following Ash Furrow's idea and I'm offering access to the repo, etc to anyone that submits a PR and gets merged; let me know if that's something you would be interested in 😄

@esttorhe esttorhe merged commit 780b258 into RxSwiftCommunity:master Jun 6, 2016
@bobspryn
Copy link
Member Author

bobspryn commented Jun 6, 2016

Hey sure. At some point I think it would make sense to move to a protocol first approach for this, similar to the open PR #25. Not sure exactly what that would look like (maybe that PR is dead on), but something I was going to look at at some point here.

@esttorhe
Copy link
Member

esttorhe commented Jun 6, 2016

Yes; definitely the protocol approach was always on my mind but at the time of the creation of this library i lacked enough knowledge to make it happen as I wanted it to be.

I need to check #25 deeply because it could be the solution or might too close to only need very few tweaks 😄

I'll send you an invite to the org right now BTW

bobspryn added a commit that referenced this pull request Jun 6, 2016
Since `self` was being sent to the subjects with a buffer of 1, it was
holding itself in the subjects indefinitely. The weakSelf I added in #30
only affects the closure itself, not the memory semantics of the subject
storing itself.

Looking back at RVMViewModel, they didn't have these as a replay
subject, so I changed them to publish subjects to match their semantics.

The throttling observable can keep it's subject since it's not sending
values of self.

I *think* this is correct, but please correct me on any of this. :)
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

Successfully merging this pull request may close these issues.

2 participants