Skip to content

Conversation

@Mike-Zhylevych
Copy link
Contributor

This pull request focuses on improving memory management and state cleanup for publisher and subscriber objects in the iOS OpenTok React Native integration. The main changes ensure that publishers and subscribers are properly removed from shared state dictionaries, reducing the risk of memory leaks or stale references.

State cleanup improvements:

  • Replaced direct assignment to nil with removeValue(forKey:) when removing publishers and publishing status from OTRN.sharedState in OTRNPublisherComponentView.swift, ensuring dictionary entries are properly deleted.
  • Added an explicit call to removeValue(forKey:) for publishers in the publisher delegate's streamDestroyed handler to guarantee publisher cleanup.

Subscriber management enhancements:

  • Added removal of subscriber objects from OTRN.sharedState.subscribers when a stream is destroyed in OpentokReactNative.swift, ensuring subscribers are cleaned up along with their streams.

Redundant code removal:

  • Removed unnecessary calls to removeValue(forKey:) for publishers and subscribers in OpentokReactNative.swift, as these are now handled more appropriately elsewhere in the code. [1] [2]

Contributing checklist

  • Code must follow existing styling conventions
  • Added a descriptive commit message
  • Sample apps updated if needed

Solves issue(s)

@Mike-Zhylevych Mike-Zhylevych merged commit 403b054 into 2.31.0 Jan 7, 2026
1 of 2 checks passed
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.

4 participants