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

# XMemFreePhysicalPages

> XMemFreePhysicalPages

Releases pages allocated with [XMemAllocatePhysicalPages](https://docs.xbox.com/reference/system/xmem/functions/xmemallocatephysicalpages.md) back to the memory manager.

## Syntax

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

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

### 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 [GetLastError](https://msdn.microsoft.com/library/windows/desktop/ms679360\(v=vs.85\).aspx).

## Remarks

Use this function to free physical pages previously allocated by calling the [XMemAllocatePhysicalPages](https://docs.xbox.com/reference/system/xmem/functions/xmemallocatephysicalpages.md) 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](https://docs.xbox.com/build/console-features/memory/system-memory-working.md).

## Requirements

**Header:** xmem.h

**Library:** xmem.lib

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

## See also

[XMemAllocatePhysicalPages](https://docs.xbox.com/reference/system/xmem/functions/xmemallocatephysicalpages.md)\
[XMem](https://docs.xbox.com/reference/system/xmem/xmem_members.md)


## Related topics

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