> ## 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

可用來在記憶體分析工具中識別記憶體配置群組的識別碼。例如，如果您針對圖形、音訊和物理等項目使用不同的堆積，則可以為每個類別指派不同的 allocatorID，以便在 PIX 中檢視記憶體擷取時輕鬆識別。

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

已釋放之記憶體的起始位址。

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

已釋放之記憶體的大小 (以位元組為單位)。

*metadata*   <br />類型：UINT64

64 位元不帶正負號的整數，可用來以其他資料標記記憶體釋放。這些額外資料會顯示在 PIX 的 UserData 資料行中。例如，您可以使用這些額外資料來識別遊戲中在指定記憶體位置已釋放之物件的類型。傳遞給 `PIXRecordMemoryFreeEvent` 的值，不必與傳遞給對應 [PIXRecordMemoryAllocationEvent](/zh-TW/reference/tools/pix3/functions/pixrecordmemoryallocationevent) 呼叫的值相符。

### 傳回值

類型：void

## 備註

PIX 記憶體追蹤事件會提供 PIX 所需的資料，以便在記憶體分析擷取中顯示從遊戲自訂記憶體配置器內進行之所有記憶體配置和釋放的相關資訊。提供此資料後，PIX 會為您的自訂配置器顯示與 `VirtualAlloc/VirtualFree` 和 `HeapAlloc/HeapFree` 呼叫相同的所有資料。

PIX 會使用 *baseAddress* 和 *size* 參數來尋找對應的配置，方式如下：如果 *baseAddress* 與傳遞給對應 [PIXRecordMemoryAllocationEvent](/zh-TW/reference/tools/pix3/functions/pixrecordmemoryallocationevent) 呼叫的 *baseAddress* 相符，PIX 只需比較位址即可配對配置與釋放。在此情況下，可以為 *size* 參數傳遞 0。如果 *baseAddress* 與對應配置中指定的值不同，則必須將 *size* 參數指定為非零值。在此情況下，PIX 會同時使用 *baseAddress* 和 *size* 來尋找對應的配置。

如果同時發生大量事件，或系統處於高負載狀態，記憶體事件可能會被 Event Tracing for Windows (ETW) 遺失。事件遺失會導致資料分析不完整。PIX 記憶體擷取 UI 會顯示警告，指出發生事件遺失。

## 需求

**標頭：** pixmemory.h

**程式庫：** pixevt.lib

**支援的平台：** XBOX One 系列主機和 XBOX Series 主機

## 概念文件

* [ATG 系統參與檢查清單](/zh-TW/build/atg-engagement/atg-systems-engagement)

## 另請參閱

[PIX 自訂記憶體配置器 (NDA 主題)](/zh-TW/tools/tools-console/pix/pix-custom-memory-allocators) [PIX API 參考](/zh-TW/reference/tools/pix3/pix3_members)<br />[PIXRecordMemoryAllocationEvent](/zh-TW/reference/tools/pix3/functions/pixrecordmemoryallocationevent)<br />[PIX (NDA 主題)](/zh-TW/tools/tools-console/pix/pix)


## Related topics

- [PIXRecordMemoryFreeEvent](/reference/tools/pix3/functions/pixrecordmemoryfreeevent.md)
- [PIXRecordMemoryAllocationEvent](/reference/tools/pix3/functions/pixrecordmemoryallocationevent.md)
