Skip to content

Most visited

Recently visited


Allocation Tracker

This tool was removed in Android Studio 3.0.

You should get the latest version of Android Studio and use the new Memory Profiler instead.

Android Monitor allows you to track memory allocation as it monitors memory use. Tracking memory allocation allows you to monitor where objects are being allocated when you perform certain actions. Knowing these allocations enables you to adjust the method calls related to those actions to optimize app performance and memory use.

The Allocation Tracker does the following:

However, it takes time and experience to learn to interpret the output from this tool.

Understanding the Allocation Tracker Display

The Allocation Tracker looks similar to the following figure:

The tool displays the following information:

Column Description
Method The Java method responsible for the allocation.
Count Total number of instances allocated.
Size The total amount of allocated memory in bytes.

Taking and Displaying a Snapshot of Allocation Data

To examine allocation data:

  1. Display a running app in the Memory Monitor.
  2. Click Start Allocation Tracking Start Allocation Tracking icon.
  3. Click Start Allocation Tracking Start Allocation Tracking icon again to deselect it and end the snapshot.
  4. The Memory Monitor displays the period when it took the snapshot. In the following figure, you can see the snapshot period, as shown on the left. By comparison, when you dump the Java heap, the Memory Monitor displays just the point where the heap snapshot was taken, as shown on the right.

    Android Studio creates the heap snapshot file with the filename using the activity package (or project) name, year, month, day, hour, minute, and second of the capture, for example,

    The Allocation Tracker appears.

  5. Optionally click the graphic icon graphic icon to display a visual representation of the data.
  6. Select the Group By menu option you want to display:
    • Group by Allocator
    • Group by Method

Viewing a Saved Allocation Tracking File

After you capture allocation data, Android Studio automatically stores it so you can view it again.

To view an allocation tracking file in the Allocation Tracker:

  1. Click Captures icon in the main window.
  2. Or select View > Tools Windows > Captures.

    The Captures window appears.

  3. Open the Allocation Tracking folder.
  4. Double-click the file to view it.

Sorting Allocation Data

To sort allocation data:

Displaying Java Source

For some items displayed in the Allocation Tracker, you can view the Java source.

To display Java source:

The source code appears in the Code Editor.

Working with Allocation Tracking Files

You can rename, locate, and delete an allocation tracking file from within Android Studio.

Renaming an allocation tracking file

If you rename a file from within Android Studio, it continues to appear in the Captures window.

To rename an allocation tracking file:

  1. In the Captures window, right-click the file and select Rename.
  2. In the Rename dialog, specify the name of the file and click OK.

Locating an allocation tracking file

You can quickly discover where Android Studio stored allocation tracking files on disk.

To locate an allocation tracking file from Android Studio:

Note: If you move an allocation tracking file, Android Studio no longer displays it in the Captures window. To display the file, use File > Open. Also, rename the file from the Captures window and not in the operating system file browser.

Deleting an allocation tracking file

To delete an allocation tracking file:

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)