---
title: Analyzing memory usage
framework: xcode
role: article
role_heading: Article
path: xcode/analyzing-memory-usage
---

# Analyzing memory usage

Manage your Metal app’s memory usage by inspecting its resources.

## Overview

Overview The Memory viewer provides comprehensive information about your app’s memory usage in Metal. The Memory viewer’s top section presents a breakdown of memory by categories, and the bottom section displays a table of resources. In the table, you can inspect resources for their memory size, configuration, and other characteristics.

Metal apps create many resources, and those resources consume a lot of memory. For example, to render an animated character using a physically based renderer, you might need buffers to hold vertex and animation data, and multiple textures to provide material attributes. When you scale these requirements to multiple characters and larger scenes, your app’s memory footprint grows significantly. Additionally, when you create Metal resources, specifying their configuration precisely has a substantial effect on performance. The Metal debugger analyzes the configuration you provide and uses it to create the underlying GPU representation of a resource. For example, if you create a resource with a private storage mode, Metal can optimize the resource for GPU access, and doesn’t need to store data in a location or format directly accessible from the CPU. Examine the bar graphs The categories in the top section of the Memory viewer organize memory usage data and provide memory totals based on the following criteria: Each bar graph consists of segments representing the largest resources that it tracks. The final segment of each bar graph shows an aggregate total for its smaller resources. Move your pointer over a segment to view a popover with the name of the resource, its size, and other information. Click a segment to get more information about that specific resource.

Inspect the resources table To improve how your app creates and manages resources, you need data about how it uses them. The Memory viewer provides information about the resources that are live in your Metal app during a capture.

The resources table provides the following information for all resource types:  |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |  For textures, you can add the following columns:  |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |   |  |  For buffers, you can add the following column:  |  |   |  |  For heaps, you can add the following columns:  |  |   |  |   |  |   |  |  For indirect command buffers, you can add the following column:  |  |   |  |  For acceleration structures, you can add the following column:  |  |   |  |  Improve your Metal workload with Insights Click the Insights button in the bottom right corner to open a popover of recommendations for the resources.

Limit your scope with filters Use the filter field at the bottom of the Memory viewer to adjust filtering criteria. Type filter terms into the field, and the resources table displays any resources with labels that match those filter terms. You can also click the filter button to add filters for specific kinds of resources, to limit the table to resources that the captured frame uses, and to limit the table to just volatile resources. When there are two or more filter terms, you can click the filter button to choose whether to match any or all of the terms. For any filter term, you can click it to choose to include or exclude resources that match that term. Group and sort resources to detect patterns By default, the resources table shows all resources in a single list. You can click a column header to sort the table by that column in ascending or descending order. You can also group the resources by certain criteria. Control-click an entry in the table to group the resources by any of the following criteria: From this same context menu, you can also choose to sort by a specific criteria, which is equivalent to clicking a column heading for sorting. Get more information about a specific resource You can also get more information about a specific resource by Control-clicking it and selecting Get Info. For example, for a texture, the additional information shows details specific to that texture, such as its pixel format and dimensions. To see the contents of the texture, double-click it. Export a memory report To share the data in the Memory viewer, you can export it in the following ways: Export a GPU trace: Choose File > Export and select a location to save the GPU trace file. You can then open the trace file later. Export a comma-separated values (CSV) file: Choose Editor > Export Memory Report to generate the CSV file. The resulting file has all of the columns you see in the resource view. You can open this file in Numbers or another spreadsheet app.

## See Also

### Metal workload analysis

- [Analyzing your Metal workload](xcode/analyzing-your-metal-workload.md)
- [Analyzing resource dependencies](xcode/analyzing-resource-dependencies.md)
- [Analyzing Apple GPU performance using a visual timeline](xcode/analyzing-apple-gpu-performance-using-a-visual-timeline.md)
- [Analyzing Apple GPU performance using counter statistics](xcode/analyzing-apple-gpu-performance-using-counter-statistics.md)
- [Analyzing Apple GPU performance with performance heat maps](xcode/analyzing-apple-gpu-performance-using-performance-heatmaps-a17-m3.md)
- [Analyzing Apple GPU performance using the shader cost graph](xcode/analyzing-apple-gpu-performance-using-shader-cost-graph-a17-m3.md)
- [Analyzing non-Apple GPU performance using counter statistics](xcode/analyzing-non-apple-gpu-performance-using-counter-statistics.md)
