Memory Leak with latest React Native Integrated App on v0.74.2
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 127k
- Forks
- 25.3k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 4
Description
Description
Facing Memory Leak with React Native app integrated with existing native app.
I am currently on React Native 0.71.1 and tried to update to React Native 0.74.2.After upgrade facing memory leak. Memory usage keeps on increasing. With version 0.72 also there is no leak faced. But from version 0.73 facing memory leak.
Following this react native callstack brownfield architecture to load react native inside existing app as we have multiple entry points from native app to load react native in Fragment and also in Activity.
Steps to reproduce
- Clone the repo -
https://github.com/callstack/react-native-brownfield - Do
yarn install - Try to open the example kotlin app
- Open profiler from android studio
- Perform Action like Click on Open React Native Button
- Capture the Heapdump
React Native Version
0.74.2
Affected Platforms
Runtime - Android
Output of npx react-native info
System:
OS: macOS 14.5
CPU: (10) arm64 Apple M1 Pro
Memory: 125.97 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.20.1
path: ~/.nvm/versions/node/v18.20.1/bin/node
Yarn:
version: 1.22.22
path: ~/.nvm/versions/node/v18.20.1/bin/yarn
npm:
version: 10.5.0
path: ~/.nvm/versions/node/v18.20.1/bin/npm
Watchman:
version: 2024.05.06.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.5
- iOS 17.5
- macOS 14.5
- tvOS 17.5
- visionOS 1.2
- watchOS 10.5
Android SDK: Not Found
IDEs:
Android Studio: 2024.1 AI-241.15989.150.2411.11948838
Xcode:
version: 15.4/15F31d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.10
path: /Users/satheshrangasamy/.jenv/shims/javac
Ruby:
version: 2.7.4
path: /Users/satheshrangasamy/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.74.2
wanted: 0.74.2
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
Stacktrace or Logs
Attached Memory Leak Profiler ScreenShot
Reproducer
https://github.com/satheshrgs-rksv/memoryleakreproducer
Screenshots and Videos
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked memoryleakreproducer: run yarn install, open the example Kotlin app, and use Android Studio's profiler while repeating the React Native action. Compare memory behavior across React Native 0.72, 0.73, and 0.74.2; done means the regression is isolated and the profiler no longer shows unbounded growth in the reproducer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin, react-native
- Domain
- mobile, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100