How do I discover memory usage of my application in Android?

前端 未结 9 2307
清酒与你
清酒与你 2020-11-21 06:27

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?

9条回答
  •  说谎
    说谎 (楼主)
    2020-11-21 06:47

    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.

提交回复
热议问题