Fix retain cycle in Client#550
Conversation
Fix retain cycle by making
|
|
I'll analyze this and get back to you. |
cameronvoell
left a comment
There was a problem hiding this comment.
thanks for finding this @Jarodl . I added small change to remove the client reference from debuginformation. I also made the client reference in Conversations private, to minimize the chance of someone trying to acceess it when it's not available.
There is a small chance an integrator uses the SDK in an untended way holding a reference to a client.conversations() and then trying to use it when the client is not in memory. But hopefully suggested use cases in our docs will make that rare enough, so still think fixing memory leak possibilities here is the better way to go.
If you can suggest a follow up at some point to pass in some context provider instead of the client so we dont have the risk of someone trying to access the unowned client reference when its not available, that would be awesome. But this is a great improvement 👍
581505d to
061222b
Compare
I updated this to use a |
a1d84d2 to
a0ee41b
Compare
|
@yewreeka I just did a dev release of these changes off latest Release version will be: |

Introduction 📟
Clientkept a strong reference toConversations,PrivatePreferences, andXMTPDebugInformation, all which kept a strong reference toClient. I also noticed thatXmtpApiClientobjects hang around because ofApiClientCache, but not sure if that's really an issue worth worrying about.Purpose ℹ️
Fix retain cycle in
ClientTesting 🧪
Ran tests and checked the memory graph in the
exampleapp