PIX on Windows

Performance tuning and debugging for DirectX 12 games on Windows

Data Type Tracking in Memory Allocation Captures

The PIX memory profiler will show data type information for heap allocations when it is available. Type information will be available if the following two conditions are met:

  1. The function that allocated the type has been decorated with __declspec(allocator)
  2. PIX can find your title’s PDB.

The memory allocation routines in the default heap are already decorated with __declspec(allocator) so unless you have custom memory allocation routines, there is no other work you’ll need to do related to __declspec(allocator).  If your heap allocations are coming from somewhere other than the default heap, see the blog post on tracking custom allocations for instructions on how to use __declspec(allocator).

The “Setting PDB Paths” section of the Function Summary Capture page provides instructions for configuring PIX to find your title’s PDBs.  Briefly, if you’re profiling on the same machine you just built your title on, the path to the PDB that the compiler stored in your title’s modules is typically all PIX needs to locate the PDB.  Otherwise, there are options on the Settings page to point PIX at your PDBs.

Type information is shown in two places in a memory capture.  First, the event list on the Events tab has a column called Type Name in which the name of the allocated type is displayed.  PIX will only be able to display the type name if the allocation routine was decorated with __declspec(allocator) as described above.

memory_type_info1

The second place that type information is displayed is on the Allocated Types tab.  Statistics are provided for every type that was allocated while the capture was running.  These statistics include the size of the type, the amount of padding in the type’s definition, the number of instances of the type that were allocated and the total number of bytes those allocations took up in the heap.

Clicking on a column sorts the event list based on the data in the column.  Sorting can quickly help you see things like which types were allocated most frequently, which types have the most padding and so on.

Selecting a row in the event list populates the Type Info view with details of the type’s layout.  The Type Info view will show you the offset and size of each field in the type.  Nested types can be expanded and collapsed.  The layout also tells you exactly where the padding sits within your type information.  This padding information helps you determine whether your layout can be optimized to reduce wasted space.

memory_type_info2