Skip to main content

XMemSetAllocationHooks

This API has been deprecated. Please refer to XMEM_ALLOCATION_HOOKS instead. Used by titles to register memory allocation hooks.

Syntax

Parameters

AllocRoutine   _In_
Type: PXMEMALLOC_ROUTINE
Pointer to the title’s allocation function. See the XMEMALLOC_ROUTINE topic for the definition of this function. FreeRoutine   _In_
Type: PXMEMFREE_ROUTINE
Pointer to the title’s deallocation function. See the XMEMFREE_ROUTINE topic for the definition of this function.

Return value

Type: VOID

Remarks

Allocations can be monitored (or overridden) with a title provided callback through the XMemSetAllocationHooks function. With proper use of this API, titles can track nearly every allocation made from the title code as well as the majority of the platform code. If titles choose not to provide their own allocation hooks, XMemAllocDefault and XMemFreeDefault will be used instead (see xmem.h for the declaration of these hooks.) If titles desire to provide allocation hooks for the sake of tracking, but do not wish to implement their own allocator, they can call into the default allocator directly. It is important to provide an implementation for both XMEMALLOC_ROUTINE and XMEMFREE_ROUTINE if you hook them; hooking only one of them will be considered an error.

Requirements

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

See also

XMem reference
XMEMALLOC_ROUTINE
XMEMFREE_ROUTINE
Last modified on August 20, 2026