TheWidlarzGroup / react-native-video

A <Video /> component for react-native
https://thewidlarzgroup.github.io/react-native-video/
MIT License
7.19k stars 2.9k forks source link

[BUG]: Memory leak in RCTView #4268

Open Varuzh1 opened 1 day ago

Varuzh1 commented 1 day ago

Version

6.7.0

What platforms are you having the problem on?

iOS

System Version

18

On what device are you experiencing the issue?

Real device

Architecture

Old architecture

What happened?

RCTVideo has a memory leak due to two retain cycles:

  1. _imaAdsManager = RCTIMAAdsManager(video: self, pipEnabled: isPipEnabled) isPipEnabled closure should be called on weak self
+_imaAdsManager = RCTIMAAdsManager(video: self, pipEnabled: {[weak self] in
+            return self?.isPipEnabled() ?? false
+        })
  1. ReactNativeVideoManager’s registerView method in the shared instance strongly retains RCTVideo instances without using them. Please clean up this unused functionality to avoid unnecessary memory retention.

Reproduction Link

repository link

Reproduction

Step to reproduce this bug are: Unmount any video component and verify that the deinit function in RCTVideo is not being called.

github-actions[bot] commented 1 day ago

Thank you for your issue report. Please note that the following information is missing or incomplete:

Please update your issue with this information to help us address it more effectively.

Note: issues without complete information have a lower priority