You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using CombineExt extensively in my projects and found it incredibly valuable.
Recently, I encountered a memory leak issue with PassthroughRelay. Upon replacing it with PassthroughSubject, the retain cycle disappeared.
It appears that PassthroughRelay fails to release its subscriptions upon receiving completion, as similarly described in this PR #85.
I've come up with a potential solution for this issue and confirmed its resolution in my project, but I'm not fully proficient with Combine. So, any comments or suggestions would be greatly appreciated.
Original Subscription’s cancel method:
func cancel(){
sink =nil}
Solution:
// Call forceFinish() in Subscription’s cancel method. // And add self.sink = nil in forceFinish method.func forceFinish(){self.sink?.shouldForwardCompletion = true
self.sink?.receive(completion:.finished)self.sink =nil// added}func cancel(){forceFinish()// replaced}
The text was updated successfully, but these errors were encountered:
Hello everyone,
I've been using CombineExt extensively in my projects and found it incredibly valuable.
Recently, I encountered a memory leak issue with
PassthroughRelay
. Upon replacing it withPassthroughSubject
, the retain cycle disappeared.It appears that
PassthroughRelay
fails to release its subscriptions upon receiving completion, as similarly described in this PR #85.I've come up with a potential solution for this issue and confirmed its resolution in my project, but I'm not fully proficient with Combine. So, any comments or suggestions would be greatly appreciated.
Original
Subscription
’scancel
method:Solution:
The text was updated successfully, but these errors were encountered: