Skip to content
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

Obj-C++ TurboModules leak memory – 600 bytes per a method call #27327

Closed
sjchmiela opened this issue Nov 25, 2019 · 0 comments
Closed

Obj-C++ TurboModules leak memory – 600 bytes per a method call #27327

sjchmiela opened this issue Nov 25, 2019 · 0 comments
Labels
Bug Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.

Comments

@sjchmiela
Copy link
Contributor

Calling TurboModules methods results in an increased memory usage. Increased memory usage may cause the app to crash.

Platform: iOS

React Native version:

System:
    OS: macOS 10.15.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
    Memory: 340.77 MB / 16.00 GB
    Shell: 5.6.2 - /usr/local/bin/zsh
  Binaries:
    Node: 12.7.0 - ~/.asdf/installs/nodejs/12.7.0/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.10.0 - ~/.asdf/installs/nodejs/12.7.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 26, 28
      Build Tools: 23.0.1, 26.0.1, 26.0.3, 27.0.3, 28.0.2, 28.0.3
      System Images: android-24 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5

Steps To Reproduce

Executing the following code block

const SampleTurboModule = TurboModuleRegistry.get('SampleTurboModule');

let i = 0;
while (i < 100000) {
  SampleTurboModule.getNumber(i);
  i += 1;
}

results in a 60 MB memory usage increase.

memoryusage

Link to a repository with a reproducing example:

https://github.com/sjchmiela/TurboModulesLeakExample

@sjchmiela sjchmiela added the Bug label Nov 25, 2019
@zhongwuzw zhongwuzw added the Platform: iOS iOS applications. label Dec 3, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Oct 2, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants