After upgrading to react native 0.59.2 from 0.56 we noticed big memory issues in iOS. I don't have a reproducible scenario yet that I can post right now, I am working on creating one. Using git bisect I was able to track it down to this commit. Unfortunately that's all the info I have at the minute I just wanted to post this to see if others have seen noticed anything similar.
React Native version:
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 38.09 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.3
System Images: android-19 | Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-23 | Intel x86 Atom, android-23 | Intel x86 Atom_64, android-23 | Google APIs ARM EABI v7a, android-23 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-25 | Google APIs ARM EABI v7a, android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.2 => 0.59.2
npmGlobalPackages:
react-native: 0.57.8
The following repo https://github.com/bhandarijiwan/memory_issue_repro has a project where this
can be reproduced. I have posted screenshots from xcode memory profile and detailed instructions on the readme.
cc @TheSavior
It looks like you are using an older version of React Native. Please update to the latest release, v0.60 and verify if the issue still exists.
react-native info on a project using the latest release.
@bhandarijiwan talked to me at Chain React and said they ran into this problem on one of GE's apps. They didn't have a small repro yet but had successfully bisected so I asked them to share the information they did have in the mean time in case others had the same problem.
I have a complete reproducible project here with the steps to reproduce in the readme. What's essentially happening from version v0.57.8 onwards is when you
return a huge string from a native module through RCTResponseSenderBlock like so 馃憞, the memory keeps growing and never goes down.
```objective-c
@implementation TestData
RCT_EXPORT_MODULE();
RCT_EXPORT_METHOD(getData: success:(RCTResponseSenderBlock)success error:(RCTResponseSenderBlock)error)
{
RCTLog(@"getData called!!!");
NSString * result = @"
resolve(@[result]);
}
@end
```
Here is a screenshot of a memory profile when this function is called over 40+ times from the javascript side using react-native version 0.57.8 and screenshot of memory profile when the same function is called over similar number of times using react-native version 0.59.2.
@TheSavior @shergin @fkgozali @cpojer @sahrens
I am closing this issue because it does not appear to have been verified on the latest release, and there has been no followup in a while.
If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here.
Reopening because I doubt this has been fixed.
@TheSavior Thanks for re-opening this. The issue does exists in the most recent version. One of my co-worker has an open PR (https://github.com/facebook/react-native/pull/25884) which hopes to fix this but it hasn't gotten any traction. Would really appreciate if anybody could shade some light on this. Thank you.
@TheSavior i have the same problem, it's working fine on android but not on iOS. Very huge memory issue after upgrading from 0.57.8 to 0.59.8.
I followed up in the PR.
PR merged! Thanks for flagging the issue and bringing a fix too!
Most helpful comment
@bhandarijiwan talked to me at Chain React and said they ran into this problem on one of GE's apps. They didn't have a small repro yet but had successfully bisected so I asked them to share the information they did have in the mean time in case others had the same problem.