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

# XMemFreePhysicalPages

> XMemFreePhysicalPages

# XMemFreePhysicalPages

Releases pages allocated with [XMemAllocatePhysicalPages](/reference/system/xmem/functions/xmemallocatephysicalpages) back to the memory manager.

<a id="syntaxSection" />

## Syntax

```cpp theme={null}
BOOL XMemFreePhysicalPages(  
         ULONG_PTR NumberOfPages,  
         PULONG_PTR PageArray  
)  
```

<a id="parametersSection" />

### Parameters

*NumberOfPages*   \_In\_\
Type: ULONG\_PTR

The number of physical memory pages to free.

*PageArray*   \_In\_reads\_(NumberOfPages)\
Type: PULONG\_PTR

A pointer to an array of page frame numbers for the allocated memory to be freed.

<a id="retvalSection" />

### Return value

Type: BOOL

If the function frees the number of pages specified in *NumberOfPages*, the return value is `TRUE`; otherwise, the function returns `FALSE`, and *NumberOfPages* is set to the number of pages that were actually released. To get extended error information, call <a href="https://msdn.microsoft.com/library/windows/desktop/ms679360(v=vs.85).aspx">GetLastError</a>.

<a id="remarksSection" />

## Remarks

Use this function to free physical pages previously allocated by calling the [XMemAllocatePhysicalPages](/reference/system/xmem/functions/xmemallocatephysicalpages) function. Fewer pages than requested in `NumberOfPages` may be freed. If the function returns `FALSE`, check the value returned in `NumberOfPages` to see how many pages were actually freed. For more information about working with physical pages, see [Working with the Microsoft GDK Game OS memory manager](/build/console-features/memory/system-memory-working).

<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

[XMemAllocatePhysicalPages](/reference/system/xmem/functions/xmemallocatephysicalpages)\
[XMem](/reference/system/xmem/xmem_members)


## Related topics

- [XMemMapPhysicalPages](/reference/system/xmem/functions/xmemmapphysicalpages.md)
- [Working with the Microsoft GDK Game OS memory manager](/build/console-features/memory/system-memory-working.md)
- [XMemMapPhysicalPagesScatter](/reference/system/xmem/functions/xmemmapphysicalpagesscatter.md)
- [XMemPreallocateFreeSpace](/reference/system/xmem/functions/xmempreallocatefreespace.md)
- [NDA topic directory - live Microsoft Learn links](/nda/nda-topic-directory.md)
