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

Investigate app memory usage #4055

Open
bengtan opened this issue Aug 23, 2019 · 6 comments
Open

Investigate app memory usage #4055

bengtan opened this issue Aug 23, 2019 · 6 comments
Assignees

Comments

@bengtan
Copy link
Contributor

bengtan commented Aug 23, 2019

There was one instance around Feb 3rd 2020 where low_memory warnings were correlated with the app crashing. See https://hippware.slack.com/archives/C2V6L53TQ/p1580781852115000?thread_ts=1580745379.101800&cid=C2V6L53TQ

We should investigate memory usage and/or try to improve it (if not too much work). For example:

  • Examine how much memory the app uses.
    • Maybe post memory usage metrics in the memory_warning bugsnag?
  • See if we can release some memory when we get the low memory warning.
    • Somehow fire the javascript garbage collector (if possible?)
  • Other stuff?

(Original Post)

Bit worried about the app being killed by the OS if it uses too much memory.

This has been mentioned (by me) as a possible cause of #4037.

@bengtan bengtan self-assigned this Aug 23, 2019
@bengtan
Copy link
Contributor Author

bengtan commented Feb 19, 2020

There was one instance around Feb 3rd 2020 where low_memory warnings were correlated with the app crashing. See https://hippware.slack.com/archives/C2V6L53TQ/p1580781852115000?thread_ts=1580745379.101800&cid=C2V6L53TQ

We should investigate memory usage and/or try to improve it (if not too much work). For example:

  • Examine how much memory the app uses.
    • Maybe post memory usage metrics in the memory_warning bugsnag?
  • See if we can release some memory when we get the low memory warning.
    • Somehow fire the javascript garbage collector (if possible?)
  • Other stuff?

@aksonov
Copy link
Contributor

aksonov commented Feb 25, 2020

App uses about 220Mb. But... Occasionally found memory leak today, by pressing menu button, so now it uses 254 after many many menu button taps. I will investigate more

@bengtan
Copy link
Contributor Author

bengtan commented Feb 26, 2020

FYI, when I (very briefly) looked at this last year, I looked for a component which could retrieve the amount of memory being used by the app and found react-native-vitals.

https://github.com/robinpowered/react-native-vitals

YMMV.

@aksonov
Copy link
Contributor

aksonov commented Feb 26, 2020

@aksonov aksonov self-assigned this Feb 27, 2020
@aksonov
Copy link
Contributor

aksonov commented Mar 2, 2020

I did many measurements of app memory usage, but they are very very unstable and not reproducible. Sometimes the difference is bigger, sometimes - smaller, it probably depends from garbage collector.

However I found some evidence where most leaks are placed - from difference snapshot I see many objects are from React Navigation. I was not able to find own app memory leaks - after I reduced code I still saw memory leaks...

Screenshot 2020-03-02 at 18.18.44.png

Similar issue: react-navigation/react-navigation#7078
And some leaks could be from React itself: facebook/react#14732

Even if I don't use react navigation, just tap to see fullscreen map and then tap again to return to previous state I see very small but memory leaks:
Screenshot 2020-03-02 at 18.46.14.png

I see similar issue here:
and here facebook/react#16138

Measurement results:

======= reduced, without navStore

before:
237mb

After 10 menu open/close attempts

246mb

2. Before:
250mb

254 after

3. 246/249

===== reduced, with navStore
1. before:
246mb

After 10 menu open/close attempts
261mb

2. Before:
229.5

After:
242mb


3. Before:
272

After:
282

4. Before
256Mb

After:
261Mb

==== latest master
Before
249Mb

After 
260Mb

@bengtan
Copy link
Contributor Author

bengtan commented Mar 16, 2020

Some bugsnags with memory stats have been posted (after 4891 was merged).

It's reporting memory usages of 126MB, 89MB, 35MB, 41MB when the low memory warning was triggered. These numbers seem ... okay?

https://app.bugsnag.com/hippware/tinyrobot-1/errors/5e6be5dcb90f3d00176c4caf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants