0

This is a conceptual doubt I have. Request some one to resolve my doubt. I have an app of size of 4.5MB and I am calculating memory usage of processes in the app. I am getting each process memory usage as 16MB...

final Runtime rt = Runtime.getRuntime(); rt.gc(); final double startSize = rt.totalMemory()-rt.freeMemory();

What I am getting is correct or wrong?Does it mean that Memory usage of app same is same as size of app?

7
  • are you sure that by "memory usage" you mean RAM usage? It's easy to mix the two up.
    – Dan Brown
    Oct 19, 2015 at 12:03
  • I saw that Runtime.getRuntime() is going to give me memory in VM
    – DsN
    Oct 19, 2015 at 12:04
  • What was that outputting?
    – Dan Brown
    Oct 19, 2015 at 12:05
  • Yeah as i said - final double startSize = rt.totalMemory()-rt.freeMemory() was outputting 16MB for each process
    – DsN
    Oct 19, 2015 at 12:06
  • good point. Hmmm, it could be cache and app data. The app itself may be 4.5mb, but what about everything else it has?
    – Dan Brown
    Oct 19, 2015 at 12:08

1 Answer 1

-1

It is correct, there is no reason for the memory usage of you app to be the same size as the apk.

1
  • 1
    Actually, there's no reason the two are related at all: A small app can eat a lot of RAM, as well as a large app can be well optimized (or just have parts of itself running).
    – Izzy
    Oct 19, 2015 at 12:59

Not the answer you're looking for? Browse other questions tagged .