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

Allocates free pages for a heap up to its hysteresis value.

<a id="syntaxSection" />

## Syntax

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

<a id="parametersSection" />

### Parameters

*MemType*   \_In\_\
Type: DWORD

The **XALLOC\_MEMTYPE\_GRAPHICS** constant that describes the heap. For more information, see [XALLOC\_ATTRIBUTES](/reference/system/xmem/structs/xalloc_attributes).

*LargeHeap*   \_In\_\
Type: BOOL

Indicates whether the heap is "large". If set to true, the heap is considered "large"; otherwise, the heap is considered "small". "Large" heaps are used to satisfy allocations that are 4 KB to 128 KB, or whose alignment is specified as 4 KB or higher; and "small" heaps are used to satisfy allocations that are smaller than 4 KB and whose alignment is specified as less than 4 KB.

<a id="retvalSection" />

### Return value

Type: BOOL

Returns `TRUE` if all pages could be allocated; otherwise, `FALSE`.

<a id="remarksSection" />

## Remarks

This function allocates free space for the heap described in *MemType*, up to the hysteresis amount for that heap. Use [XMemGetAllocationHysteresis](/reference/system/xmem/functions/xmemgetallocationhysteresis) to get the hysteresis amount for a heap, or [XMemSetAllocationHysteresis](/reference/system/xmem/functions/xmemsetallocationhysteresis) to specify the hysteresis amount for a heap. For more information, see [Memory](/build/console-features/memory/system-memory-overview).

<a id="requirementsSection" />

## Requirements

**Header:** xmem.h

**Library:** xmem.lib

**Supported platforms:** XBOX One family consoles and XBOX Series consoles

<a id="seealsoSection" />

## See also

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


## Related topics

- [XPersistentLocalStorageSpaceInfo](/reference/system/xpersistentlocalstorage/structs/xpersistentlocalstoragespaceinfo.md)
- [XPersistentLocalStorageGetSpaceInfo](/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetspaceinfo.md)
- [XPersistentLocalStoragePromptUserForSpaceResult](/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragepromptuserforspaceresult.md)
- [Working with the Microsoft GDK Game OS memory manager](/build/console-features/memory/system-memory-working.md)
- [XPersistentLocalStoragePromptUserForSpaceAsync](/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragepromptuserforspaceasync.md)
