Skip to content

Fix native connectors staying in memory after destroy - #506

Open
tvanlaerhoven wants to merge 2 commits into
mainfrom
fix/connector-map-leak
Open

tvanlaerhoven wants to merge 2 commits into
mainfrom
fix/connector-map-leak

Conversation

@tvanlaerhoven

@tvanlaerhoven tvanlaerhoven commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Summary

On Android, a destroyed connector and the player it references stayed in memory for the lifetime of the app. Each native module keeps a map of connectors keyed by view tag, and destroy never removed the entry. In an app that mounts and unmounts players, every unmounted player leaked.

  • Adobe, Adobe Edge, AdScript, Nielsen (Android): destroy now removes the map entry and destroys the connector on the UI queue thread, the same thread that adds entries.
  • Youbora (Android): destroy now removes the map entry and disables the plugin on the UI queue thread.
  • Gemius (Android): destroy now removes the map entry on the UI queue thread. The connector destroy call was already disabled and stays disabled.
  • Bitmovin (Android): destroy already ran on the UI queue thread; it now also removes the map entry.
  • Adobe Edge (iOS): destroy now removes the dictionary entry. The other iOS modules already did this.
  • Changeset with a patch bump for the seven packages.

Test plan

  • compileDebugKotlin for the Adobe, Adobe Edge, Bitmovin and Nielsen modules from apps/e2e/android
  • AdScript, Gemius and Youbora Android compile (not projects in the e2e app, so not built locally)
  • Adobe Edge iOS build (not built locally)
  • Runtime check: mount and unmount a player with connectors several times and confirm in a heap dump that the connector count does not grow

No package-level npm test or npm run typescript was run: the change is native-only.

Generated with Devin


Devin Review

The native modules kept destroyed connectors in their tag map, which
kept the connector and its player in memory.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a521fe9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@theoplayer/react-native-analytics-adobe Patch
@theoplayer/react-native-analytics-adobe-edge Patch
@theoplayer/react-native-analytics-adscript Patch
@theoplayer/react-native-analytics-bitmovin Patch
@theoplayer/react-native-analytics-gemius Patch
@theoplayer/react-native-analytics-nielsen Patch
@theoplayer/react-native-analytics-youbora Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 3 potential issues.

Devin Review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Required package checks skipped

The test plan skips the required package checks. All five affected packages define a typecheck, and Adobe Edge also defines a unit-test suite.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread .changeset/connector-map-leak.md Resolved

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

Devin Review

Comment thread .changeset/connector-map-leak.md Resolved
Comment thread .changeset/connector-map-leak.md Resolved

This branch has not been deployed

No deployments
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.

1 participant