How to check that how much memory(RAM) is getting consumed by any of currently running app on device?
Thanks.
Tap Developer options and then tap Memory. In the resulting screen (Figure B), you'll see a list of the average memory used by the device in the past three hours (you can adjust the time frame, by tapping the time drop-down at the top). The Memory usage window in Android 12.
Now select “Developer Options.” Tap “Memory” to see the RAM usage stats. You'll see the “Average Memory Use” at the top of the screen. Scroll down a bit further and select “Memory Used by Apps.”
To calculate free memory (in RAM) using /proc/meminfo you have to get the aggregate of MemFree, Buffers, Cached and SwapCached. There is an API for this purpose provided by Android which works on API 16 and on wards. Meminfo is helpful if you are targeting older APIs.
Look at the ActivityManager.
getRunningAppProcesses
will get you a list of PIDs, and then getProcessMemoryInfo
will give you memory details about them.
See the following thread for an complete, in-depth answer: How do I discover memory usage of my application in Android?.
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