RAM Usage High - but why

I know this is an old topic but over the last year I have notice RAM usage is getting higher in an Ionic app. There appears to be a difference between RAM usage and heap size stated by others in this forum. I am addressing actual RAM usage on an Android. This does not appear to be as critical on IOS. I know Android apps will need more memory but the amount is high with Ionic and I wish to understand why. Sure the web view is a large part of it but…

So an example. Be sure to push this app to your Android device using ionic android run as shown below.

$ ionic start myApp tabs
$ cd myApp
$ ionic platform add android
$ ionic run android

Exercise the app by selecting the three tabs on top of the view.

use the package name in config.xml to get memory usage from adb

$ adb shell dumpsys meminfo com.ionicframework.myapp536749

image

See the value in red. 127547 KB is 127 MB. I also checked the RAM usage with the “Memory Usage” app from Play Store and it shows right around the same usage.

Off course the heap size is smaller and this appears to be what others have quoted when they speak of “App memory usage”.

So my question is simple. Is this normal? Does everyone see these types of memory usage? Given this is a default app generated with the ionic command and I have not added any code I can only assume this is normal, but perhaps someone out there has found ways to cut RAM usage.

2 Likes

+1
Great question!
My app is using google maps and I see the same memory usage as you see.

Would be nice to have an official answer on this, specially about techniques about how to minimize memory usage.

1 Like

Kinda same here. Developing for both iOS and Android and while in iOS it goes from 40 to 60 MB in Android it jumps to a whooping 300 to 600 MB. Anyone else having this? Sidemenu with tabs and a google maps, that’s all it has.

My app currently has an intro slider with some images, tabs, and some signup/login screens. It starts out with 35 MB then goes up a bit as I click through the various pages, but not going over 50 MB.

But for the rest I don’t have any real functionality yet and only the basic Cordova plugins.

Ionic version is 1.1.0.

I see really high RAM usage despite a small heap size too. A heap snapshot using the chrome device inspect tool shows that the JS heap size stays between 12MB-25MB. But the RAM usage in android’s active applications view goes between 120MB - 250MB, making the app practically unusable on most Android devices.
Any help will be greatly appreciated. I’ve spent the last two weeks trying to improve UX on Android, and now considering an ios only release :frowning:

1 Like

+1
@ionic can we have a feedback ?

1 Like

+1 @Ionic I have the same problem. Between 140MB - 280MB

1 Like

We found that some of our issues were caused by the ionic spinner / loader. Especially if you have pull to refresh etc. The animated SVG gets added to the dom but it never gets removed again. So they keep spinning and keep adding up even when not in view.

2 Likes

I had same problem. And I looked up for plugins that I don’t use. Removed them and everything goes normal.
Before removing unused plugins: Ram usage is near 160 - 190 MB. and CPU usage is 15% - 20%
Now it uses max. 80 MB RAM and 5% CPU usage.
Some plugins made your app slow.