Android Developer: Memory Monitor demo

Source: Internet
Author: User

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

  • A mobile phone that enables developer options.

  • An application that starts USB Debugging. Use your own or Sunshine sample application.

Use Memory Monitor

Bytes -----------------------------------------------------------------------------------------

  1. If you are using a mobile device, connect it to your computer.

  2. Open your application in Android Studio, build the source code, and run it on your device or simulator.

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

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

      1. Over time, the icon is updated to display the changes in memory usage.

      2. When your App allocates and releases memory, the amount of memory allocated in the figure changes.

      3. When you see that the allocated memory drops a lot, a garbage collection event occurs.

      4. You can click the recycle bin icon to forcibly execute a garbage collection event.

        Figure 2. Force a GC (garbage collection) event.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.