Version: 2018.4
Rendering Profiler
Audio Profiler

Memory Profiler module

The Memory module visualizes counters that represent the total allocated memory in your application. You can use the memory module to see information such as the number of loaded objects and the memory that they take in total per category. You can also see the number of GC allocations per ProfilerA window that helps you to optimize your game. It shows how much time is spent in the various areas of your game. For example, it can report the percentage of time spent rendering, animating or in your game logic. More info
See in Glossary
frame.

Using the memory module when profiling in the Editor

When you profile your application in the Editor, all of the numbers the Memory module displays indicates the memory usage in the Editor, and not the application’s release platform. These numbers are generally larger than when running on the release platform, because running the Unity Editor uses specific objects that take up memory, and the Editor window uses extra memory. Additionally, the memory that the Profiler itself uses is displayed, since Unity cannot cleanly separate it from the memory that the Play mode Player uses.

For more precise numbers and memory usage for your application, connect the Profiler to the running player via the Attach to Player menu. This returns the actual usage on the target device.

Chart categories

The Memory module is divided into six charts that display detailed information on where memory is spent in your application. You can change the order of the categories in the chart by dragging and dropping them in the chart’s legend. You can also click a category’s colored legend to toggle its display.

Category Description
Total Allocated The total memory your application has used
Texture Memory How much memory the TexturesAn image used when rendering a GameObject, Sprite, or UI element. Textures are often applied to the surface of a mesh to give it visual detail. More info
See in Glossary
in your application have used
MeshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info
See in Glossary
Memory
How much memory the Meshes in your application have used
Material Count The number of MaterialAn asset that defines how a surface should be rendered, by including references to the Textures it uses, tiling information, Color tints and more. The available options for a Material depend on which Shader the Material is using. More info
See in Glossary
instances in your application
Object Count The number of native object instances in your application
Total GC Allocated The amount of memory used by the GC heap
GC Allocated The amount of memory allocated per frame on the GC heap

Module details pane

There are two views available in the module details pane, located at the bottom of the Profiler window: Simple and Detailed. To change the view, select it from the dropdown in the top left of the module details pane.

Simple view

The Simple view displays an overview of how memory is used throughout Unity in real-time on a per-frame basis.

Unity reserves memory pools for allocations to avoid asking the operating system for memory too often. This is displayed as a reserved amount, and how much is used.

The simple memory module view
The simple memory module view

The areas covered by this are:

  • Total: Accumulated value from all areas below
  • Unity: The amount of memory allocations in native Unity code, tracked by the native memory manager system and allocated in memory pools according to their type, source and platform specific allocation patterns.
  • Mono: The total heap size and used heap size managed code uses. This memory is garbage collected.
  • GfxDriver: The estimated amount of memory the driver uses on Textures, render targets, ShadersA small script that contains the mathematical calculations and algorithms for calculating the Color of each pixel rendered, based on the lighting input and the Material configuration. More info
    See in Glossary
    , and Mesh data.
  • Audio: The Audio system’s estimated memory usage
  • Video: The Video system’s estimated memory usage
  • Profiler: Total memory the Profiler uses

The numbers that are displayed are different to those displayed the Task Manager or Activity Monitor. This is because some usage is untracked by the Memory Profiler. This includes memory some drivers or plug-insA set of code created outside of Unity that creates functionality in Unity. There are two kinds of plug-ins you can use in Unity: Managed plug-ins (managed .NET assemblies created with tools like Visual Studio) and Native plug-ins (platform-specific native code libraries). More info
See in Glossary
use, and memory used for executable code. On platforms that support getting the total memory size of the application from the OS, the Total System Memory Usage is over 0 and is the same size in a Task Manager or Activity Monitor.

Underneath the overview of where the memory is spent, are memory statistics for some of the most common AssetAny media or data that can be used in your game or Project. An asset may come from a file created outside of Unity, such as a 3D model, an audio file or an image. You can also create some asset types in Unity, such as an Animator Controller, an Audio Mixer or a Render Texture. More info
See in Glossary
and object types. These statistics include the count (before the slash) and the used memory.

In this list, the Object Count displays the total number of native objects that your application creates. If this number rises over time, your application is creating objects that are never destroyed.

Detailed view

You can use the Detailed view to take a snapshot of your application’s current state. Click the Take Sample button to capture detailed memory usage for the current target. It takes the Profiler a lot of time to obtaining this data, so the Detailed view does not give you real-time details. After the Profiler takes a sample, the Profiler window displays a tree view where you can explore your application’s memory usage in more detail.

The detailed memory module view
The detailed memory module view

Enable the Gather object references setting at the top of the module details pane to collect information about what might be referencing an object at the time of the snapshot. This information is displayed in the right-hand pane of the window.

The objects that use memory are divided into the following categories in the tree view:

  • Other: Objects that are neither assets, GameObjectsThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
    See in Glossary
    , or components. Information such as used memory Unity uses for different systems can be found here.
  • Not Saved: Objects marked as DontSave
  • Builtin Resources: Unity Editor resources or Unity default resources, such as Shaders you have added to the Always Included Shaders list of the Graphics settings.
  • Assets: Assets referenced from user or native code
  • SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
    See in Glossary
    Memory
    : Objects and attached components

When you click on an object in the Assets or Scene Memory list, it’s highlighted in the Project or Scene viewAn interactive view into the world you are creating. You use the Scene View to select and position scenery, characters, cameras, lights, and all other types of Game Object. More info
See in Glossary
.

Note: In the Other category, memory reported under System.ExecutableAndDlls is read-only memory. The operating system might discard these pages as needed and later reload them from the file system. This generates lower memory usage, and usually does not directly contribute to the operating system’s decision to kill your application if it uses too much memory. Some of these pages might also be shared with other applications that are using the same frameworks.

Memory Profiler package

In addition to the Memory module, you can use the Memory Profiler package to analyze memory usage in your application in even more detail. You can store and compare snapshots to find memory leaks more easily, or see the memory layout to find memory fragmentation issues. For information on the Memory Profiler package, see the Memory Profiler documentation.

Rendering Profiler
Audio Profiler