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

# XMEM_ALLOCATION_HOOKS

> XMEM_ALLOCATION_HOOKS

Represents the hooks to memory allocation and de-allocation functions for a title.

## Syntax

```cpp theme={null}
typedef struct XMEM_ALLOCATION_HOOKS {  
    PXMEMALLOC_ROUTINE AllocRoutine;  
    PXMEMFREE_ROUTINE FreeRoutine;  
} XMEM_ALLOCATION_HOOKS  
```

### Members

*AllocRoutine*\
Type: PXMEMALLOC\_ROUTINE

A pointer to the title's allocation function. For more information about implementing an application-defined memory allocation function, see [XMEMALLOC\_ROUTINE](https://docs.xbox.com/reference/system/xmem/functions/xmemalloc_routine.md) and [XMemAlloc](https://docs.xbox.com/reference/system/xmem/functions/xmemalloc.md).

*FreeRoutine*\
Type: PXMEMFREE\_ROUTINE

A pointer to the title's de-allocation function. For more information about implementing an application-defined memory de-allocation function, see [XMEMFREE\_ROUTINE](https://docs.xbox.com/reference/system/xmem/functions/xmemfree_routine.md) and [XMemFree](https://docs.xbox.com/reference/system/xmem/functions/xmemfree.md).

## Remarks

This structure is used by the [XMEM\_SET\_ALLOCATION\_HOOKS](https://docs.xbox.com/reference/system/xmem/macros/xmem_set_allocation_hooks.md) macro to register application-defined memory allocation and de-allocation functions for your title. For more information about graphics memory, see [Graphics memory overview for the GDK](https://docs.xbox.com/build/core-features/graphics/graphics-memory-overview.md).

> [!NOTE]
>
> The [XMemSetAllocationHooks](https://docs.xbox.com/reference/system/xmem/functions/xmemsetallocationhooks.md) function is deprecated. Use this macro instead of the `XMemSetAllocationHooks` function to register your title's memory allocation and de-allocation functions.

## Requirements

**Header:** xmem.h

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

## See also

[XMEM\_SET\_ALLOCATION\_HOOKS](https://docs.xbox.com/reference/system/xmem/macros/xmem_set_allocation_hooks.md)\
[XMEMALLOC\_ROUTINE](https://docs.xbox.com/reference/system/xmem/functions/xmemalloc_routine.md)\
[XMEMFREE\_ROUTINE](https://docs.xbox.com/reference/system/xmem/functions/xmemfree_routine.md)\
[XMem](https://docs.xbox.com/reference/system/xmem/xmem_members.md)


## Related topics

- [XMEM_SET_ALLOCATION_HOOKS](https://docs.xbox.com/reference/system/xmem/macros/xmem_set_allocation_hooks.md)
- [XMemSetAllocationHooks](https://docs.xbox.com/reference/system/xmem/functions/xmemsetallocationhooks.md)
- [XMemFreeDefault](https://docs.xbox.com/reference/system/xmem/functions/xmemfreedefault.md)
- [XMEMFREE_ROUTINE callback](https://docs.xbox.com/reference/system/xmem/functions/xmemfree_routine.md)
- [XMEMALLOC_ROUTINE callback](https://docs.xbox.com/reference/system/xmem/functions/xmemalloc_routine.md)
