Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - How to track the memory usage of an any running app on device programmatically?

Tags:

android

memory

How to check that how much memory(RAM) is getting consumed by any of currently running app on device?

Thanks.

like image 698
Varundroid Avatar asked May 11 '11 11:05

Varundroid


People also ask

How do I see app memory usage Android?

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.

How can I tell which app is using more RAM on my phone?

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.”

How do I get Meminfo on my Android?

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.


1 Answers

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?.

like image 51
Brian Clow Avatar answered Sep 19 '22 21:09

Brian Clow