-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[Android] memory leak in Android #35890
Labels
Needs: Triage 🔍
Platform: Android
Android applications.
Stale
There has been a lack of activity on this issue and it may be closed soon.
Comments
facebook-github-bot
pushed a commit
that referenced
this issue
Feb 8, 2023
Summary: fix memory leak in Android The issues link: #35890 Explain Defect since 0.65, when call dispatchViewUpdates, we add judge mNumRootViews>0 <img width="531" alt="image" src="https://user-images.githubusercontent.com/20136688/213394240-4c284df4-27de-494e-8eed-8e5f30796cce.png"> When we call removeRootView, it will decrease the mNumRootViews before dispatchViewUpdates <img width="430" alt="image" src="https://user-images.githubusercontent.com/20136688/213394611-d47ab49f-fc7a-4dd1-9836-fe667d655660.png"> So when we remove the last rootview, it will skip call dispatchViewUpdates and do not remove it, it will cause memory leak Explain Fix We should use the original root view num to judge, we can get it from NativeViewHierarchyManager ## Changelog [ANDROID] [FIXED] - fix memory leak in Android <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> Pull Request resolved: #35889 Reviewed By: christophpurrer Differential Revision: D42636805 Pulled By: sshic fbshipit-source-id: 76845b5c1fbdeaf1ebe990356e82059dc1e5b46e
OlimpiaZurek
pushed a commit
to OlimpiaZurek/react-native
that referenced
this issue
May 22, 2023
Summary: fix memory leak in Android The issues link: facebook#35890 Explain Defect since 0.65, when call dispatchViewUpdates, we add judge mNumRootViews>0 <img width="531" alt="image" src="https://user-images.githubusercontent.com/20136688/213394240-4c284df4-27de-494e-8eed-8e5f30796cce.png"> When we call removeRootView, it will decrease the mNumRootViews before dispatchViewUpdates <img width="430" alt="image" src="https://user-images.githubusercontent.com/20136688/213394611-d47ab49f-fc7a-4dd1-9836-fe667d655660.png"> So when we remove the last rootview, it will skip call dispatchViewUpdates and do not remove it, it will cause memory leak Explain Fix We should use the original root view num to judge, we can get it from NativeViewHierarchyManager ## Changelog [ANDROID] [FIXED] - fix memory leak in Android <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> Pull Request resolved: facebook#35889 Reviewed By: christophpurrer Differential Revision: D42636805 Pulled By: sshic fbshipit-source-id: 76845b5c1fbdeaf1ebe990356e82059dc1e5b46e
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
github-actions
bot
added
the
Stale
There has been a lack of activity on this issue and it may be closed soon.
label
Aug 6, 2023
This issue was closed because it has been stalled for 7 days with no activity. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Needs: Triage 🔍
Platform: Android
Android applications.
Stale
There has been a lack of activity on this issue and it may be closed soon.
Description
When we Integration RN as App SubActivity, if we close the Activity, it will cause memory leak
Explain Defect
since 0.65, when call dispatchViewUpdates, we add judge mNumRootViews>0
When we call removeRootView, it will decrease the mNumRootViews before dispatchViewUpdates
So when we remove the last rootview, it will skip call dispatchViewUpdates and do not remove it, it will cause memory leak
Version
0.65 - ~
Output of
npx react-native info
N/A
Steps to reproduce
it will cause memory leak
Snack, code example, screenshot, or link to a repository
code example
https://github.com/feiyin0719/RNMemoryLeakAndroid
The text was updated successfully, but these errors were encountered: