Skip to content

Conversation

@YoavGro
Copy link
Contributor

@YoavGro YoavGro commented Oct 5, 2023

Change the TokenGetter to a weak reference to prevent a memory leak in the client.

The client holds the CentrifugeClientConfig which has a strong reference to a CentrifugeConnectionTokenGetter
The problem can happen once the CentrifugeConnectionTokenGetter implementation is the one that is holding a strong reference to the Client.

This creates a circular strong reference Between the App -> Client -> Config -> TokenGetter -> App

Change the TokenGetter to a weak reference to prevent a memory leak in the client
@FZambia
Copy link
Member

FZambia commented Oct 5, 2023

@YoavGro hello, thanks a lot for PR!

What do you think - it seems we better add the same to Subscription tokenGetter?

public var tokenGetter: CentrifugeSubscriptionTokenGetter?

@YoavGro
Copy link
Contributor Author

YoavGro commented Oct 5, 2023

Yep, good idea.
Done

@FZambia FZambia merged commit 2628c8c into centrifugal:master Oct 6, 2023
@FZambia
Copy link
Member

FZambia commented Oct 6, 2023

Thanks! I'll try to make a new release till the end of this week

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.

2 participants