Skip to content

Fix Android player staying in memory when destroyed during playback - #1016

Merged
tvanlaerhoven merged 1 commit into
developfrom
fix/android-noisy-receiver-leak
Nov 19, 2026
Merged

tvanlaerhoven merged 1 commit into
developfrom
fix/android-noisy-receiver-leak

Conversation

@tvanlaerhoven

@tvanlaerhoven tvanlaerhoven commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Summary

On Android, a player that was destroyed while playing stayed in memory.

ReactTHEOplayerContext registers a becoming-noisy BroadcastReceiver on play and unregisters it on pause. destroy() removes the player listeners first, so no pause handler runs afterwards and the receiver stays registered. The registered receiver keeps the player context, and the player it owns, reachable.

  • destroy() now calls audioBecomingNoisyManager.setEnabled(false) after removing the listeners. The call is a no-op when the receiver is not registered.
  • Added a changelog entry under Unreleased.

Related: THEOplayer/react-native-connectors#506 fixes the connector side of the same leak.

Test plan

  • ./gradlew :react-native-theoplayer:compileDebugKotlin from example/android
  • Runtime check: mount a player, start playback, unmount it, repeat, and confirm in a heap dump that the ReactTHEOplayerContext count does not grow

No unit test was added.

Generated with Devin


Devin Review

The receiver is registered on play and removed on pause, but destroy
detaches the pause listener first. A player destroyed during playback
kept the receiver registered, which kept the player context in memory.

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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@tvanlaerhoven
tvanlaerhoven merged commit 9d0841a into develop Nov 19, 2026
11 checks passed
@tvanlaerhoven
tvanlaerhoven deleted the fix/android-noisy-receiver-leak branch November 19, 2026 09:11
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