Skip to main content

XMEMALLOC_ROUTINE callback

Defines the syntax of the memory allocation routines, XMemAlloc and XMemAllocDefault.

Syntax

Parameters

Size   _In_
Type: SIZE_T
The size of the memory block that is being requested, in bytes. Attributes   _In_
Type: ULONGLONG
The attributes of the memory allocation. For more information, see XALLOC_ATTRIBUTES.

Return value

Type: PVOID A pointer to the allocated memory, if successful; otherwise, NULL.

Remarks

This function definition is used in the XMEM_ALLOCATION_HOOKS structure to define the XMemAlloc and XMemAllocDefault functions. Similarly, the XMEMFREE_ROUTINE function definition is used to define the XMemFree and XMemFreeDefault functions.
Source code for the default implementation of XMemAlloc is installed as part of the Microsoft Game Development Kit (GDK). For more information, see the XMemAllocDefault function in \GXDK\gameKit\Source\amd64\heap.c.

Requirements

Header: xmem.h Library: xmem.lib Supported platforms: XBOX One family consoles and XBOX Series consoles

See also

Diagnostics and memory tracking
XMem
XMemAllocDefault
Last modified on August 20, 2026