Skip to content

[Android] Very high memory usage. App becomes very laggy! #16590

Closed
@kesha-antonov

Description

@kesha-antonov

Hello! I have an app with not very complex UI. But with lots of code. And it takes a lot of memory in android. And becomes very laggy after few screens loaded. In iOS code works without any lag in dev/prod modes.

Is this a bug report?

Yes. In iOS same code works great whether is in dev mode or production mode.

Here's memory usage without remote debugger turned on:
dumpsys_without_remote_debugger copy

Here's memory usage with remote debugger turned on (see memory usage reduced):
dumpsys_with_remote_debugger copy

Even if I reduce views - memory usage is still high:
dumpsys_with_remote_debugger_reduced_views

Have you read the Contributing Guidelines?

Yes.

Environment

Environment:
OS: macOS High Sierra 10.13
Node: 6.11.3
Yarn: Not Found
npm: 5.4.2
Watchman: 4.9.0
Xcode: Xcode 9.0 Build version 9A235
Android Studio: 2.3 AI-162.3871768

Packages: (wanted => installed)
react: ^16.0.0 => 16.0.0
react-native: github:facebook/react-native#60c898d8643daf80ef8175af7dc8411709eff379 => 1000.0.0

RN - 0.50-rc

Steps to Reproduce

  1. git clone https://github.com/kesha-antonov/rn_memory_usage_test_high_usage
  2. cd rn_memory_usage_test_high_usage
  3. npm i
  4. nano node_modules/react-native-sentry/android/build.gradle
  5. Change sdk tools to
    compileSdkVersion 25
    buildToolsVersion '25.0.3'
  1. Set your android ndk, sdk paths in androids/local.properties
  2. react-native run-android
  3. adb shell dumpsys meminfo com.rn_memory_usage_test_high_usage
  4. See a lot of memory used (115 MB and above with just 21 (!!!) views, 125.5 MB with 126 useless views)

screen shot 2017-10-29 at 22 11 06

screen shot 2017-10-29 at 23 49 48

Expected Behavior

25-75 MB of memory usage will be fine I guess.
With no lags, no frame drops

Actual Behavior

A lot of memory used: 165-261 MB
Users experience good look of first screen and when they go through the app it becomes laggy

Reproducible Demo

https://github.com/kesha-antonov/rn_memory_usage_test_high_usage

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions