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

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

## Syntax

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

### Parameters

*MemType*   \_In\_\
Type: DWORD

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

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

### Return value

Type: BOOL

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

## Remarks

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

## Requirements

**Header:** xmem.h

**Library:** xmem.lib

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

## See also

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


## Related topics

- [XPersistentLocalStorageSpaceInfo](https://docs.xbox.com/reference/system/xpersistentlocalstorage/structs/xpersistentlocalstoragespaceinfo.md)
- [XPersistentLocalStorageGetSpaceInfo](https://docs.xbox.com/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetspaceinfo.md)
- [XPersistentLocalStoragePromptUserForSpaceResult](https://docs.xbox.com/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragepromptuserforspaceresult.md)
- [XPersistentLocalStoragePromptUserForSpaceAsync](https://docs.xbox.com/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragepromptuserforspaceasync.md)
- [ApuFree](https://docs.xbox.com/reference/audio/apu/functions/apufree.md)
