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

# XMEM_ALLOCATION_HOOKS

> XMEM_ALLOCATION_HOOKS

# XMEM\_ALLOCATION\_HOOKS

代表遊戲之記憶體配置和解除配置函式的攔截。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
typedef struct XMEM_ALLOCATION_HOOKS {  
    PXMEMALLOC_ROUTINE AllocRoutine;  
    PXMEMFREE_ROUTINE FreeRoutine;  
} XMEM_ALLOCATION_HOOKS  
```

<a id="membersSection" />

### 成員

*AllocRoutine*\
類型：PXMEMALLOC\_ROUTINE

遊戲配置函式的指標。如需實作應用程式定義之記憶體配置函式的詳細資訊，請參閱 [XMEMALLOC\_ROUTINE](/zh-TW/reference/system/xmem/functions/xmemalloc_routine) 和 [XMemAlloc](/zh-TW/reference/system/xmem/functions/xmemalloc)。

*FreeRoutine*\
類型：PXMEMFREE\_ROUTINE

遊戲解除配置函式的指標。如需實作應用程式定義之記憶體解除配置函式的詳細資訊，請參閱 [XMEMFREE\_ROUTINE](/zh-TW/reference/system/xmem/functions/xmemfree_routine) 和 [XMemFree](/zh-TW/reference/system/xmem/functions/xmemfree)。

<a id="remarksSection" />

## 備註

[XMEM\_SET\_ALLOCATION\_HOOKS](/zh-TW/reference/system/xmem/macros/xmem_set_allocation_hooks) 巨集會使用此結構，為您的遊戲註冊應用程式定義的記憶體配置和解除配置函式。如需圖形記憶體的詳細資訊，請參閱 [GDK 的圖形記憶體概觀](/zh-TW/build/core-features/graphics/graphics-memory-overview)。

<Note>[XMemSetAllocationHooks](/zh-TW/reference/system/xmem/functions/xmemsetallocationhooks) 函式已被取代。請使用此巨集 (而非 `XMemSetAllocationHooks` 函式) 來註冊遊戲的記憶體配置和解除配置函式。</Note>

<a id="requirementsSection" />

## 需求

**標頭：** xmem.h

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

<a id="seealsoSection" />

## 另請參閱

[XMEM\_SET\_ALLOCATION\_HOOKS](/zh-TW/reference/system/xmem/macros/xmem_set_allocation_hooks)\
[XMEMALLOC\_ROUTINE](/zh-TW/reference/system/xmem/functions/xmemalloc_routine)\
[XMEMFREE\_ROUTINE](/zh-TW/reference/system/xmem/functions/xmemfree_routine)\
[XMem](/zh-TW/reference/system/xmem/xmem_members)


## Related topics

- [XMEM_ALLOCATION_HOOKS](/reference/system/xmem/structs/xmem_allocation_hooks.md)
- [XMemSetAllocationHooks](/reference/system/xmem/functions/xmemsetallocationhooks.md)
