Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Memory leak in RCTView #4268

Open
Varuzh1 opened this issue Oct 31, 2024 · 5 comments
Open

[BUG]: Memory leak in RCTView #4268

Varuzh1 opened this issue Oct 31, 2024 · 5 comments
Labels

Comments

@Varuzh1
Copy link

Varuzh1 commented Oct 31, 2024

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.

@Varuzh1 Varuzh1 added the bug label Oct 31, 2024
Copy link

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

  • reproduction link

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

Note: issues without complete information have a lower priority

Copy link

github-actions bot commented Dec 1, 2024

This issue is stale because it has been open for 30 days with no activity. If there won't be any activity in the next 14 days, this issue will be closed automatically.

@github-actions github-actions bot added the stale Closed due to inactivity or lack or resources label Dec 1, 2024
@ng-ha
Copy link

ng-ha commented Dec 10, 2024

@Varuzh1 I have the same issue. Do you have any solutions?

@freeboub
Copy link
Collaborator

freeboub commented Dec 10, 2024

@Varuzh1 can you please open a pr with your changes, I would be happy to review it quickly!

@ng-ha
Copy link

ng-ha commented Dec 10, 2024

I tried the code you provided, but it didn’t work:

+_imaAdsManager = RCTIMAAdsManager(video: self, pipEnabled: {[weak self] in
+            return self?.isPipEnabled() ?? false
+        })

I’m facing a serious issue where the device (IOS) heats up after watching videos multiple times. The reason seems to be that the memory isn’t released properly. Can you take a look at this issue, @freeboub ? I would really appreciate it.

@github-actions github-actions bot removed the stale Closed due to inactivity or lack or resources label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants