Android Developer: Memory Monitor demo
This demo shows the basic usage and process of the Memory Monitor tool in Android Studio. Memory Monitors reports the Memory allocated by your app in real time.
Its advantages:
Display available and used memory in the chart, and garbage collection events over time.
Quickly test whether the app slows down may be related to the transition garbage collection event.
Quickly test whether app crashes may be related to memory depletion.
Prerequisites
Bytes -----------------------------------------------------------------------------------------
Use Memory Monitor
Bytes -----------------------------------------------------------------------------------------
If you are using a mobile device, connect it to your computer.
Open your application in Android Studio, build the source code, and run it on your device or simulator.
In Android Studio, choose Tools> Android> Memory Monitor. You can also click the Android tab in the lower left corner of the application window to start the Android runtime window. The CPU and Memory Monitor view appears.
Figure 1. Start Memory Monitor
Once Memory Monitory starts to track your device, a trace chart is displayed, and the total Memory usage changes over time.
Dark blue: the memory size currently used by your app.
Light blue: available, unallocated memory.
Figure 1. Memory allocated and available in Momory Monitor
Over time, the icon is updated to display the changes in memory usage.
When your App allocates and releases memory, the amount of memory allocated in the figure changes.
When you see that the allocated memory drops a lot, a garbage collection event occurs.
You can click the recycle bin icon to forcibly execute a garbage collection event.
Figure 2. Force a GC (garbage collection) event.