question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
lhfiiicommented, Dec 5, 2017

I have replace fresco with glide and the leak still exists. It seems that the leak comes from other native module. I have found a lot of YogaNode in the FinalizeReference chain.

0reactions
kesha-antonovcommented, Jul 29, 2018

@rahulnpadalkar It’s Android Studio

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Common Causes to Laggy Android Devices (And How to Fix ...
In fact, here we listed 5 causes to a lagging experience on the Android and how you can counter them with the help...
Read more >
Why Is My Phone Lagging? 6 Possible Causes - MakeUseOf
Signs of lag include delays in touch responsiveness, app freezes, and slow performance. If your phone lags, it may have difficulties ...
Read more >
Why do Android phones lag much despite having much RAM?
Lagging and stuttering are, in my experience, caused more by filling up all of the phone's storage. It can also be caused by...
Read more >
Manage your app's memory - Android Developers
Manage your app's memory ; Monitor available memory and memory usage. Release memory in response to events; Check how much memory you should...
Read more >
How To Reduce RAM Usage On Android - YouTube
David & David show you how to reduce RAM usage on an Android. RAM stands for Random Access Memory. Sometimes, all it takes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found