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

# XMemPreallocateFreeSpace

> XMemPreallocateFreeSpace

# XMemPreallocateFreeSpace

为堆分配达到其滞后值的空闲页。

## 语法

```cpp theme={null}
BOOL XMemPreallocateFreeSpace(  
         DWORD MemType,  
         BOOL LargeHeap  
)  
```

### 参数

*MemType*   \_In\_\
类型：DWORD

描述堆的 **XALLOC\_MEMTYPE\_GRAPHICS** 常量。有关详细信息，请参阅 [XALLOC\_ATTRIBUTES](https://docs.xbox.com/zh-CN/reference/system/xmem/structs/xalloc_attributes.md)。

*LargeHeap*   \_In\_\
类型：BOOL

指示该堆是否为“大型”。如果设置为 true，则将堆视为“大型”；否则视为“小型”。“大型”堆用于满足 4 KB 到 128 KB 的分配，或其对齐方式被指定为 4 KB 或更高的分配；而“小型”堆用于满足小于 4 KB 且对齐方式被指定为小于 4 KB 的分配。

### 返回值

类型：BOOL

如果可以分配所有页，则返回 `TRUE`；否则返回 `FALSE`。

## 备注

此函数为 *MemType* 中描述的堆分配空闲空间，最多分配到该堆的滞后量。使用 [XMemGetAllocationHysteresis](https://docs.xbox.com/zh-CN/reference/system/xmem/functions/xmemgetallocationhysteresis.md) 获取堆的滞后量，或使用 [XMemSetAllocationHysteresis](https://docs.xbox.com/zh-CN/reference/system/xmem/functions/xmemsetallocationhysteresis.md) 指定堆的滞后量。有关详细信息，请参阅[内存](https://docs.xbox.com/zh-CN/build/console-features/memory/system-memory-overview.md)。

## 要求

**头文件：** xmem.h

**库：** xmem.lib

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

## 另请参阅

[XALLOC\_ATTRIBUTES](https://docs.xbox.com/zh-CN/reference/system/xmem/structs/xalloc_attributes.md)\
[XMem](https://docs.xbox.com/zh-CN/reference/system/xmem/xmem_members.md)


## Related topics

- [XPersistentLocalStorageSpaceInfo](https://docs.xbox.com/zh-CN/reference/system/xpersistentlocalstorage/structs/xpersistentlocalstoragespaceinfo.md)
- [XMemFreeDefault](https://docs.xbox.com/zh-CN/reference/system/xmem/functions/xmemfreedefault.md)
- [XMemFreePhysicalPages](https://docs.xbox.com/zh-CN/reference/system/xmem/functions/xmemfreephysicalpages.md)
- [XPersistentLocalStorageGetSpaceInfo](https://docs.xbox.com/zh-CN/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetspaceinfo.md)
- [PIXRecordMemoryFreeEvent](https://docs.xbox.com/zh-CN/reference/tools/pix3/functions/pixrecordmemoryfreeevent.md)
