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 memory leak in WithLatestFrom #140

Merged

Conversation

TTOzzi
Copy link
Contributor

@TTOzzi TTOzzi commented Aug 4, 2022

Resolves #139

The withLatestFrom stream has been completed, but it has been confirmed that otherSubscription is remaining and causing memory leaks.
Modified it to call cancel when WithLatestFrom's Subscription is deinitialized.

@TTOzzi TTOzzi changed the title Fix with latest from memory leak Fix memory leak in WithLatestFrom Aug 4, 2022
@codecov
Copy link

codecov bot commented Aug 4, 2022

Codecov Report

Merging #140 (67d8ede) into main (1f6b0df) will increase coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head 67d8ede differs from pull request most recent head bcda2ca. Consider uploading reports for the commit bcda2ca to get more accurate results

@@            Coverage Diff             @@
##             main     #140      +/-   ##
==========================================
+ Coverage   95.45%   95.47%   +0.01%     
==========================================
  Files          72       72              
  Lines        4266     4284      +18     
==========================================
+ Hits         4072     4090      +18     
  Misses        194      194              
Impacted Files Coverage Δ
Sources/Operators/WithLatestFrom.swift 96.00% <100.00%> (+0.05%) ⬆️
Tests/WithLatestFromTests.swift 98.66% <100.00%> (+0.05%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@adlerj
Copy link

adlerj commented Aug 5, 2022

This fix works in the sample project I made

@freak4pc
Copy link
Member

freak4pc commented Aug 5, 2022

Awesome find and fix, thanks for this and for the extra test, too! 🤩

@freak4pc freak4pc self-requested a review August 5, 2022 17:22
@freak4pc freak4pc merged commit 4954960 into CombineCommunity:main Aug 5, 2022
@TTOzzi TTOzzi deleted the fix-with-latest-from-memory-leak branch August 6, 2022 02:57
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 in ReplaySubject, WithLatestFrom, and anything else that uses the DemandBuffer
3 participants