-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Detected memory leak while integrating RN app with existing android app #37105
Comments
|
facing the same issue, any updates? |
same issue, mark |
does anyone able to resolve it? |
Are there any solutions to the same problem? |
we are using an old version 0.64.4. we see the same problem [Update]: Maybe as a workaround, use reactInstanceManager.destroy() |
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. |
This issue was closed because it has been stalled for 7 days with no activity. |
in my case , ANR happened with stack above, any help please? React-Native: 0.73.8 |
we have absolutely the same issue with RN 0.69 I created StackOverflow issue |
Same here |
Description
I have integrated a simple RN app with android by following these steps.
I have created an android app and on its first screen I have created two CTA's to load two different bundles.
(Bundles are created using react-native bundle command).
To load bundle by clicking on any CTA, I use this code:
reactInstanceManager = ReactInstanceManager.builder() .setApplication(application) .setCurrentActivity(this) .setBundleAssetName("index.android.bundle") .setJSMainModulePath(modulePath) .addPackages(packages) .setUseDeveloperSupport(BuildConfig.DEBUG) .setInitialLifecycleState(LifecycleState.RESUMED) .setJavaScriptExecutorFactory(HermesExecutorFactory()) .build()
reactRootView?.startReactApplication(reactInstanceManager, registry, null)
setContentView(reactRootView)
This loads RN app inside android app.
I have also implemented the code inside
onResume
,onPause
, andonDestroy
methodsoverride fun onDestroy() { super.onDestroy() if (reactInstanceManager != null) { reactInstanceManager?.onHostDestroy(this) } if (reactRootView !== null) { reactRootView?.unmountReactApplication() } }
React Native Version
0.71.6
Output of
npx react-native info
System:
OS: macOS 11.4
CPU: (8) x64 Apple M1
Memory: 132.62 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.19.0 - ~/.nvm/versions/node/v14.19.0/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.6.0 - /opt/homebrew/bin/npm
Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK:
API Levels: 23, 26, 28, 29, 30, 31, 32, 33
Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 33.0.0
System Images: android-29 | Intel x86 Atom_64, android-29 | Google Play ARM 64 v8a, android-32 | Google APIs ARM 64 v8a
Android NDK: 22.1.7171670
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9619390
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.16.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.7
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
Simply create an android app and integrate it with RN app using steps described in official doc: Doc Link
And install LeakCanary Library to check memory Leak.
It will show a memory leak.
Snack, code example, screenshot, or link to a repository
When I run LeakCanary to check memory leaks then it show 1 memory leak:
The text was updated successfully, but these errors were encountered: