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

# XMEMFREE_ROUTINE callback

> XMEMFREE_ROUTINE callback

# XMEMFREE\_ROUTINE callback

定义内存释放例程 [XMemFree](https://docs.xbox.com/zh-CN/reference/system/xmem/functions/xmemfree.md) 和 `XMemFreeDefault` 的语法。

## 语法

```cpp theme={null}
VOID XMEMFREE_ROUTINE(  
         PVOID Address,  
         ULONGLONG Attributes  
)  
```

### 参数

*Address*   \_In\_\
类型：PVOID

要释放的内存的地址。

*Attributes*   \_In\_\
类型：ULONGLONG

内存分配的属性。有关更多信息，请参阅 [XALLOC\_ATTRIBUTES](https://docs.xbox.com/zh-CN/reference/system/xmem/structs/xalloc_attributes.md)。

### 返回值

类型：VOID

无。

## 备注

此函数定义在 [XMEM\_ALLOCATION\_HOOKS](https://docs.xbox.com/zh-CN/reference/system/xmem/structs/xmem_allocation_hooks.md) 结构中用于定义 [XMemFree](https://docs.xbox.com/zh-CN/reference/system/xmem/functions/xmemfree.md) 和 `XMemFreeDefault` 函数。同样，[XMEMALLOC\_ROUTINE](https://docs.xbox.com/zh-CN/reference/system/xmem/functions/xmemalloc_routine.md) 函数定义用于定义 [XMemAlloc](https://docs.xbox.com/zh-CN/reference/system/xmem/functions/xmemalloc.md) 和 `XMemAllocDefault` 函数。

> [!NOTE]
>
> `XMemFree` 默认实现的源代码作为 Microsoft Game Development Kit (GDK) 的一部分进行安装。有关更多信息，请参阅 `\GXDK\gameKit\Source\amd64\heap.c` 中的 `XMemFreeDefault` 函数。

## 要求

**标头：** xmem.h

**库：** xmem.lib

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

## 请参阅

[诊断与内存跟踪](https://docs.xbox.com/zh-CN/build/console-features/memory/system-memory-diagnostics.md)\
[XMem](https://docs.xbox.com/zh-CN/reference/system/xmem/xmem_members.md)\
[XMemFreeDefault](https://docs.xbox.com/zh-CN/reference/system/xmem/functions/xmemfreedefault.md)


## Related topics

- [XMEMALLOC_ROUTINE callback](https://docs.xbox.com/zh-CN/reference/system/xmem/functions/xmemalloc_routine.md)
- [PHEAP_TRACK_ALLOC_ROUTINE callback](https://docs.xbox.com/zh-CN/reference/system/xmem/functions/pheap_track_alloc_routine.md)
- [PHEAP_TRACK_FREE_ROUTINE callback](https://docs.xbox.com/zh-CN/reference/system/xmem/functions/pheap_track_free_routine.md)
- [PHEAP_TRACK_REALLOC_ROUTINE callback](https://docs.xbox.com/zh-CN/reference/system/xmem/functions/pheap_track_realloc_routine.md)
- [XMemSetAllocationHooks](https://docs.xbox.com/zh-CN/reference/system/xmem/functions/xmemsetallocationhooks.md)
