How can I find the memory used on my Android application, programmatically?
I hope there is a way to do it. Plus, how do I get the free memory of the phone too?
Android Studio 0.8.10+ has introduced an incredibly useful tool called Memory Monitor.
What it's good for:
- Showing available and used memory in a graph, and garbage collection events over time.
- Quickly testing whether app slowness might be related to excessive garbage collection events.
- Quickly testing whether app crashes may be related to running out of memory.
Figure 1. Forcing a GC (Garbage Collection) event on Android Memory Monitor
You can have plenty good information on your app's RAM real-time consumption by using it.