Android - get allocated memory

Is there a way how to determine the actual allocated memory in an Android application (in code)?

thank

Points

+5
source share
1 answer

If you are talking about Android Application Memory, then

ActivityManager.getMemoryInfo() - This is our highest level API for viewing shared memory usage.

At the lower level, you can use the Debug API to get kernel-level memory usage information.

Note. Starting with version 2.0, there is also an API ActivityManager.getProcessMemoryInfoto get this information about another process.

You can also parse the command /proc/meminfo. and get an answer to the memory information.

EDIT:

ActivityManager activityManager =  (ActivityManager) getSystemService(ACTIVITY_SERVICE);
MemoryInfo memoryInfo = new MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
Log.i("memory free", "" + memoryInfo.availMem);

SO:

+3

All Articles