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

# XMemPreallocateFreeSpace

> XMemPreallocateFreeSpace

# XMemPreallocateFreeSpace

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

<a id="syntaxSection" />

## 语法

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

<a id="parametersSection" />

### 参数

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

描述堆的 **XALLOC\_MEMTYPE\_GRAPHICS** 常量。有关详细信息，请参阅 [XALLOC\_ATTRIBUTES](/reference/system/xmem/structs/xalloc_attributes)。

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

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

<a id="retvalSection" />

### 返回值

类型：BOOL

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

<a id="remarksSection" />

## 备注

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

<a id="requirementsSection" />

## 要求

**头文件：** xmem.h

**库：** xmem.lib

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

<a id="seealsoSection" />

## 另请参阅

[XALLOC\_ATTRIBUTES](/reference/system/xmem/structs/xalloc_attributes)\
[XMem](/reference/system/xmem/xmem_members)


## Related topics

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