I am creating a App that uses React Native in some part, but not all.
I have an instance of RCTRootView
Setting it to nil
and removing it from the superview doesn't seem to release it.
The CPU and RAM stays high, so it seems the React app stills executing on the threads.
How can I stop it?
Thanks :)
yes. More code means a longer execution time. Not only will it take unnecessary CPU "power", console. log is also synchronous so it will make your application slower (even by a few nanoseconds).
Memory leakage, a React Native performance issue, may occur due to unnecessary processes that run in the background in an Android app. Try using scrolling lists like SectionList, FlatList, or VirtualList, instead of ListView.
log statements. Though console. log( ) statements are important to debug your react native app but these statements in huge numbers can cause performance lag in your react native app. The reason being that these pieces of code are synchronous so they might slow down your app.
Some improvements that can be applied to optimize images in a React Native app are: Using PNG format instead of JPG format. Using smaller-resolution images. Using WEBP format for images – this can help reduce the images' binary size on iOS and Android by nearly a third of the original size!
RCTBridge * bridge
[bridge invalidate];
bridge = nil;
invalidate and nil will clear all modules from jsbundle and it clears RCTRootView instances from memory . Note bridge is object of RCTBridge.
You have to create your own RTCBridge separately and release it ( = nil), not only the view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With