is there any way, how to determine actual allocated memory in Android application (in code)?
Thanks
Waypoint
If you talking about Android Application Memory then,
ActivityManager.getMemoryInfo()
is our highest-level API for looking at overall memory usage.
Going lower-level, you can use the Debug API to get raw kernel-level information about memory usage.
Note starting with 2.0 there is also an API, ActivityManager.getProcessMemoryInfo
, to get this information about another process.
Also you can parse /proc/meminfo
command. and get the response for memory information.
EDIT:
ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
MemoryInfo memoryInfo = new MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
Log.i("memory free", "" + memoryInfo.availMem);
For more information look at these two SO questions:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With