Although there are similar questions (such as A), their answers do not solve my problem.
I am using Android Studio 1.5.1 targeting Android API 18 (before Android KitKat 4.4, so I’m dealing with Dalvik, not ART runtime).
My question is:
In Android, how to find the total used memory (native and non-native) in bytes used by my app programmatically without using any native code?
Update:
Why other similar solutions do not solve my problem?
Here is the problem in more details:
I have two methods, before() and after(). Bothe methods have the same code that calculate the total used memory but method after() has an integer local variable
int consume = 123;
The problem is the after() method should show the total used memory + 4 (which is the size of the int variable consume), but instead of that both give me the same total used memory.