Structured Retain Cycles #1721
Unanswered
tylerjames
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi @tylerjames ! Forgive me if I'm completely wrong; I don't often answer these questions because I'm not confident in what I know hahaha ;) Your |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've got a
@Dependency
that is a client structured similarly to the WebSocket demo app.Basically my
FeatureClient
needs to interact with some other clients (WebRTCClient
andSignalingClient
) and so it needs to create and hold onto aclass
that implementsWebRTCClientDelegate
andSignalingClientDelegate
.I've noticed that my
FeatureClientDelegate
does not get deallocated and will get created again next time I load my feature.My
FeatureClientDelegate
is created in aninitializeConnect
closure like this:I call it from my store like this:
Successfully making it through this initialization seems to create a retain cycle somehow. I don't know if it's obvious from this code or if I'm creating my
FeatureClientDelegate
class incorrectly. I see that the one in the WebSocket demo is nested inside an actor like this:But I'm not sure if that's for memory reasons or just for concurrency reasons.
Sorry for the lengthy post, I'm just not quite sure how to clear this problem. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions