Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android App taking up a lot of memory

While working on my Android application, I recently check a task manager to see how memory my application is racking up.

Right now my application has two ad banners being executed by AdMob services and then an interface fragment for a Google Map. Aside from all that I then have a menu in which I utilize a container to which I add views to it in Java code. I prefer this over a list-view as it is more light weight and easier for me to structure what I want to do with the views (and I can use Androids native animation system when adding/removing the views).

The views being added to the container are being added by a loop structure based on conditions. The views in their interface structure also have a small image-view utilizing a small local drawable.

All of this is somehow adding up to my application 44.8 MB in memory which seems abnormally high from previous development numbers. This is also the first time I decided to use the container to add views through a loop rather then the adapter with list-view method.

Can anyone tell right off hand why my application is taking up so much memory right off? This is my first time utilizing all these components: AdMob Banners, Google Maps, and Containers with added Views.

My LogCat shows no warnings of doing anything inefficiently. Just curious to see if I am doing anything wrong. If anyone has any ideas I am open to provide any source code.

like image 793
Vesica Piscis Avatar asked Jun 04 '14 04:06

Vesica Piscis


People also ask

Why Android apps are taking so much of space?

The stored cache and data by the app makes it larger ,some apps also download data from internet . For this problem you can go to app setting and move the application to SD card without rooting it will not create exact that much space but some space will be created.

Why are my applications using so much memory?

Close Unnecessary Programs and Applications However, the high memory usage problem is mainly due to the overcrowding of many internal processes. Therefore, it helps to stop the unnecessary programs and applications that are running. Open the Task Manager and check any extra programs you aren't using.

What is eating up my RAM Android?

To find out which apps are using your memory, you must first enable the Developer options. To do that, open the Settings app and then tap About Phone. Scroll to the bottom of that window and then tap Build number 7 times. After the seventh tap, you'll be informed that the Developer options has been enabled.


2 Answers

I think 44.8Mb is pretty normal for a modern Android application. My bet is on Google Maps since it's very resource-consuming library (both CPU-wise and memory-wise). Anyway, you can try to sequentially remove each of the component out of app and see how it affects memory footprint.

like image 170
Andrey Chernih Avatar answered Nov 10 '22 10:11

Andrey Chernih


As Andrey have already said, 44.8Mb is not too much for an Android application. But you can use DDMS to track allocations and heap updates to see exactly is taking up this memory. See this: https://developer.android.com/tools/debugging/debugging-memory.html

Besides, I would recommend using a ListView with adapter because items in ListView can be recycled, which can improve performance considerablly (See this tutorial).

like image 5
Rafi Kamal Avatar answered Nov 10 '22 08:11

Rafi Kamal