mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
bc766ec7f8
Summary: fix memory leak in Android The issues link: https://github.com/facebook/react-native/issues/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: https://github.com/facebook/react-native/pull/35889 Reviewed By: christophpurrer Differential Revision: D42636805 Pulled By: sshic fbshipit-source-id: 76845b5c1fbdeaf1ebe990356e82059dc1e5b46e
Building React Native for Android
See the Building from Source guide on the React Native website.
Running tests
When you submit a pull request CircleCI will automatically run all tests. To run tests locally, see Testing guide on the React Native website.