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

# XMemGetAllocationStatistics

> XMemGetAllocationStatistics 會透過 XMEM_HEAP_STATISTICS 結構，擷取指定 XBOX GDK 遊戲堆積的配置計數和位元組總數。

# XMemGetAllocationStatistics

取得指定堆積的統計資料。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
BOOL XMemGetAllocationStatistics(  
         DWORD MemType,  
         BOOL LargeHeap,  
         PXMEM_HEAP_STATISTICS Statistics  
)  
```

<a id="parametersSection" />

### 參數

*MemType*   \_In\_<br />類型：DWORD

描述堆積的 `XALLOC_MEMTYPE_GRAPHICS_*` 常數。如需詳細資訊，請參閱 [XALLOC\_ATTRIBUTES](/zh-TW/reference/system/xmem/structs/xalloc_attributes) 中的 [MemoryType](/zh-TW/reference/system/xmem/structs/xalloc_attributes#memorytypeSection) 一節。

*LargeHeap*   \_In\_<br />類型：BOOL

如果堆積為「大型」，則為 `TRUE`；否則為 `FALSE`。「大型」堆積用於滿足 4 KB 到 128 KB 的配置，或對齊指定為 4 KB 或更高的配置。相較之下，「小型」堆積用於滿足小於 4 KB 且對齊指定為小於 4 KB 的配置。

*Statistics*   \_Inout\_<br />類型：PXMEM\_HEAP\_STATISTICS

指向將包含統計資料之 [XMEM\_HEAP\_STATISTICS](/zh-TW/reference/system/xmem/structs/xmem_heap_statistics) 結構的指標。

<a id="retvalSection" />

### 傳回值

類型：BOOL

如果可以填入 [XMEM\_HEAP\_STATISTICS](/zh-TW/reference/system/xmem/structs/xmem_heap_statistics) 結構，則傳回 `TRUE`；否則傳回 `FALSE`。

<a id="remarksSection" />

## 備註

此函式會在 `XMEM_HEAP_STATISTICS` 結構中，傳回 `MemType` 所描述之堆積的統計資料，例如最大配置大小和配置計數。如需圖形記憶體的詳細資訊，請參閱 [GDK 的圖形記憶體概觀](/zh-TW/build/core-features/graphics/graphics-memory-overview)。

下列範例說明如何使用此函式來取得 "garlic" (CPU 寫入合併且 GPU 非一致) 記憶體的統計資料。

```cpp theme={null}
XMEM_HEAP_STATISTICS statistics;
statistics.dwSize = sizeof( statistics );
BOOL success = XMemGetAllocationStatistics(XALLOC_MEMTYPE_GRAPHICS_WRITECOMBINE, TRUE, &statistics);  
```

<a id="requirementsSection" />

## 需求

**標頭：** xmem.h

**程式庫：** xmem.lib

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

<a id="seealsoSection" />

## 另請參閱

[診斷與記憶體追蹤](/zh-TW/build/console-features/memory/system-memory-diagnostics)<br />[XALLOC\_ATTRIBUTES](/zh-TW/reference/system/xmem/structs/xalloc_attributes)<br />[XMEM\_HEAP\_STATISTICS](/zh-TW/reference/system/xmem/structs/xmem_heap_statistics)<br />[XMem](/zh-TW/reference/system/xmem/xmem_members)


## Related topics

- [NDA topic directory - live Microsoft Learn links](/nda/nda-topic-directory.md)
- [XMemGetWin32HeapStatistics](/reference/system/xmem/functions/xmemgetwin32heapstatistics.md)
- [XMemGetWorkingSetStatistics](/reference/system/xmem/functions/xmemgetworkingsetstatistics.md)
- [WIN32_HEAP_STATISTICS](/reference/system/xmem/structs/win32_heap_statistics.md)
- [PFMemGetFunctions](/services/playfab/api-references/c/pfplatform/functions/pfmemgetfunctions.md)
