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

Syntax

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. Possible error codes include the following. This list isn’t exhaustive.

Remarks

Call this function before XblInitialize. You can’t call it again until XblCleanupAsync completes. This function lets the app install custom memory allocation routines to service all requests for new memory buffers instead of using the 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 isn’t permitted. This function also passes the callbacks to libHttpClient by calling HCMemSetFunctions. If libHttpClient is already initialized, it keeps its existing memory hooks, and this function still succeeds.

Requirements

Header: xbox_live_global_c.h Library: Microsoft.Xbox.Services.142.C.lib or Microsoft.Xbox.Services.143.C.lib

See also

xbox_live_global_c
Last modified on October 29, 2026