Question

I'm studying about RAM memory, and I see that helloworld from the android samples uses about 13MB of android memory.
How does it happen, if the app have only an activity with a TextView?
And what to do to reduce memory usage? and which uses more memory?

Was it helpful?

Solution

I see that helloworld from the android samples uses about 13MB of android memory

You did not indicate how you are measuring this memory usage.

Please read:

Note that memory usage on modern operating systems like Linux is an extremely complicated and difficult to understand area. In fact the chances of you actually correctly interpreting whatever numbers you get is extremely low

Anything that you use that lies beyond what is written in those posts may or may not be accurate. And even interpreting what Process Stats is telling you is a bit of a challenge.

How does it happen, if the app hase only an activity with a TextView?

It is unlikely that your app has 13MB of consumed heap space. What you are seeing probably includes memory shared with other processes, for the Dalvik VM, platform libraries, and framework classes.

Android developers should be worrying about their heap space, first and foremost. Most of the memory usage beyond that is driven by the platform, not you (notable exception: NDK libraries that you load and the memory that they consume, for code and data).

what to do to reduce memory usage?

Probably nothing, because probably nothing needs to be done.

For more complex apps, as thepoosh mentions in a comment, you can generate a heap dump from DDMS and examine that in MAT to see if your app is leaking memory, resulting in an over-use of heap space.

You are welcome to try using android.os.Debug to try to get a sense of how much the heap is being utilized at runtime.

And, you are welcome to read the documentation on memory usage.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top