> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PIXRecordMemoryFreeEvent

> PIXRecordMemoryFreeEvent

# PIXRecordMemoryFreeEvent

记录一个内存释放事件。

## 语法

```cpp theme={null}
void PIXRecordMemoryFreeEvent(  
         USHORT allocatorId,  
         void* baseAddress,  
         size_t size,  
         UINT64 metadata  
)  
```

### 参数

*allocatorId*   <br />类型：USHORT

一个 ID，你可以使用它在内存分析器中标识内存分配组。例如，如果你有针对图形、音频和物理等不同事项的不同堆，则可以为这些类别中的每一个分配不同的 allocatorID，以便在 PIX 中查看内存捕获时易于识别。

*baseAddress*   <br />类型：void\*

已释放内存的起始地址。

*size*   <br />类型：size\_t

已释放内存的字节大小。

*metadata*   <br />类型：UINT64

一个 64 位无符号整数，你可以使用它以额外数据来标记内存释放。这些额外数据在 PIX 中显示在 UserData 列中。例如，你可以使用这些额外数据来识别游戏中在给定内存位置已释放的对象类型。传递给 `PIXRecordMemoryFreeEvent` 的值不必与传递给对应的 [PIXRecordMemoryAllocationEvent](/reference/tools/pix3/functions/pixrecordmemoryallocationevent) 调用的值匹配。

### 返回值

类型：void

## 备注

PIX 内存跟踪事件提供 PIX 所需的数据，以便在内存分析捕获中显示有关游戏自定义内存分配器内所有内存分配和释放的信息。通过提供这些数据，PIX 将为你的自定义分配器显示与 `VirtualAlloc/VirtualFree` 和 `HeapAlloc/HeapFree` 调用相同的所有数据。

PIX 使用 *baseAddress* 和 *size* 参数定位相应的分配，方式如下：如果 *baseAddress* 与传递给对应 [PIXRecordMemoryAllocationEvent](/reference/tools/pix3/functions/pixrecordmemoryallocationevent) 调用的 *baseAddress* 匹配，PIX 将简单地通过比较地址来匹配分配和释放。在这种情况下，可以为 *size* 参数传递 0。如果 *baseAddress* 与对应分配中指定的值不同，则 *size* 参数必须指定为非零值。在这种情况下，PIX 将同时使用 *baseAddress* 和 *size* 来查找相应的分配。

如果同时发生大量事件或系统处于繁重负载下，则内存事件可能会被 Windows 事件跟踪 (ETW) 丢失。事件丢失将导致数据分析不完整。PIX 内存捕获 UI 将显示指示事件丢失的警告。

## 要求

**头文件：** pixmemory.h

**库：** pixevt.lib

**支持的平台：** XBOX One 系列主机和 XBOX Series 主机

## 概念文档

* [ATG 系统合作清单](/build/atg-engagement/atg-systems-engagement)

## 另请参阅

[PIX 自定义内存分配器（NDA 主题）](/tools/tools-console/pix/pix-custom-memory-allocators) [PIX API 参考](/reference/tools/pix3/pix3_members)<br />[PIXRecordMemoryAllocationEvent](/reference/tools/pix3/functions/pixrecordmemoryallocationevent)<br />[PIX（NDA 主题）](/tools/tools-console/pix/pix)


## Related topics

- [PIXRecordMemoryAllocationEvent](/zh-CN/reference/tools/pix3/functions/pixrecordmemoryallocationevent.md)
- [PIX3](/zh-CN/reference/tools/pix3/pix3_members.md)
- [game_chat_free_memory_callback](/zh-CN/reference/chat/gamechat2/functions/game_chat_free_memory_callback.md)
- [PartyFreeMemoryCallback](/zh-CN/services/playfab/multiplayer/networking/reference/callbacks/partyfreememorycallback.md)
- [PFMultiplayerFreeMemoryCallback](/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/callbacks/pfmultiplayerfreememorycallback.md)
