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

# XblMemSetFunctions

> XblMemSetFunctions

# XblMemSetFunctions

Optionally sets the memory hook functions to allow callers to route memory allocations to their own memory manager.

## Syntax

```cpp theme={null}
HRESULT XblMemSetFunctions(  
         XblMemAllocFunction memAllocFunc,  
         XblMemFreeFunction memFreeFunc  
)  
```

### Parameters

*memAllocFunc*   \_In\_opt\_\
Type: XblMemAllocFunction

A pointer to the custom allocation callback to use, or a null pointer to restore the default.

*memFreeFunc*   \_In\_opt\_\
Type: XblMemFreeFunction

A pointer to the custom freeing callback to use, or a null pointer to restore the default.

### Return value

Type: HRESULT

HRESULT return code for this API operation.

## Remarks

This must be called before XblInitialize() and can not be called again until XblCleanup(). This method allows the application to install custom memory allocation routines in order to service all requests for new memory buffers instead of using default allocation routines. The *memAllocFunc* and *memFreeFunc* parameters can be null pointers to restore the default routines. Both callback pointers must be null or both must be non-null. Mixing custom and default routines is not permitted.

## Requirements

**Header:** xbox\_live\_global\_c.h

**Library:** Microsoft.Xbox.Services.14x.GDK.C.lib

## See also

[xbox\_live\_global\_c](/reference/live/xsapi-c/xbox_live_global_c/xbox_live_global_c_members)


## Related topics

- [XblMemGetFunctions](/reference/live/xsapi-c/xbox_live_global_c/functions/xblmemgetfunctions.md)
- [XblInitialize](/reference/live/xsapi-c/xbox_live_global_c/functions/xblinitialize.md)
- [XblCleanupAsync](/reference/live/xsapi-c/xbox_live_global_c/functions/xblcleanupasync.md)
- [XSAPI C overview](/services/xbox-services/fundamentals/xbox-services-api/live-xsapi-flat-c.md)
- [HCMemSetFunctions](/reference/live/httpclient/httpclient/functions/hcmemsetfunctions.md)
