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

Share replay leak #86

Merged
merged 2 commits into from
Apr 4, 2021
Merged

Conversation

jabeattie
Copy link
Contributor

Attempts to fix #85

I added a test that proved that the source publisher was retained after everything had been nilled out/released.

I then added the cancel() method call in the forwardCompletionToBuffer method inside ReplaySubject.Subscription as this causes the subscription to then be released.

As I mentioned in the issue I raised, I'm not familiar enough to know what the other implications of this could be (it seems to all work fine for me in my project) so would appreciate any help or comments.

@freak4pc
Copy link
Member

Hey @jasdev - mind looking into this, as you know ReplaySubject well enough here?

Thanks @jabeattie :)

@codecov
Copy link

codecov bot commented Mar 29, 2021

Codecov Report

Merging #86 (11cedcd) into main (8a070de) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #86      +/-   ##
==========================================
+ Coverage   97.10%   97.12%   +0.01%     
==========================================
  Files          62       62              
  Lines        3315     3336      +21     
==========================================
+ Hits         3219     3240      +21     
  Misses         96       96              
Impacted Files Coverage Δ
Sources/Subjects/ReplaySubject.swift 100.00% <100.00%> (ø)
Tests/ShareReplayTests.swift 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a070de...11cedcd. Read the comment docs.

Copy link
Member

@jasdev jasdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for PRing this @jabeattie! Looks good to me after a read through — really appreciate you adding a test to verify the fix. ✅

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.

Memory leak issue with ReplaySubject
3 participants