Closed funct7 closed 3 years ago
@funct7 Hi, it's true that there is a leak in startCoroutine()
when you pass CoScope
. I'll fix it in next release.
To fix it in current release, please don't pass scope
parameter in startCoroutine()
or add scope.cancel()
in Reactor.deinit()
.
Thank you 🙂
Thank you. Once it's fixed, I'll see if other issues are also resolved.
@funct7 You can try with this fix - https://github.com/belozierov/SwiftCoroutine/releases/tag/2.1.10
Most of the issues have gone away--also with my real project. Thank you so much!
The coroutine still crashes when self
is captured with unowned
, but I'm guessing it's because the block of code is not guaranteed to be canceled as soon as self
and CoScope
assoiciated with it is deallocated.
I noticed some weird behavior in my projects concerning
CoChannel
s, and I wasn't sure if I was using it wrong or there was something buggy going on.I have a scoped coroutine running and
self
is captured withunowned
.Not sure if I'm explaining the situation correctly, so I have a demo target here.
I also noticed that all the
CoScope
s are kepts around when the memory graph debugger is run like so:The objects that own the
CoScope
instances are deallocated as expected.The slowing down (or rather the skipping values) corresponds to the number of zombie
CoScope
instances. So when there are fourCoScope
instances lying around, the log prints like so(I also noticed other weird behavior with my real project like objects captured by the SwiftCoroutine and not deallocating, but I'm not sure if it's in any way related to the issue demonstrated by the sample project. I can provide further information if you're interested.)
Sorry about the haphazard reporting, but it was hard to determine if they all pointed to the same cause or if they were all separate, so I decided to just lay it out.