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

# PartyManager::SetMemoryCallbacks

> Optionally configures the memory allocation and freeing callbacks the Party library should use.

Optionally configures the memory allocation and freeing callbacks the Party library should use.

## Syntax

```cpp theme={null}
PartyError SetMemoryCallbacks(  
    PartyAllocateMemoryCallback allocateMemoryCallback,  
    PartyFreeMemoryCallback freeMemoryCallback  
)  
```

### Parameters

**`allocateMemoryCallback`**   [PartyAllocateMemoryCallback](/services/playfab/multiplayer/networking/reference/callbacks/partyallocatememorycallback)

A pointer to the custom allocation callback to use.

**`freeMemoryCallback`**   [PartyFreeMemoryCallback](/services/playfab/multiplayer/networking/reference/callbacks/partyfreememorycallback)

A pointer to the custom freeing callback to use.

### Return value

PartyError

`c_partyErrorSuccess` if the call succeeded or an error code otherwise. The human-readable form of the error code can be retrieved via [GetErrorMessage()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_geterrormessage).

## Remarks

This method allows the title to install custom memory allocation functions in order to service all requests by the Party library for new memory buffers instead of using its default allocation functions. <br /><br /> The `allocateMemoryCallback` and `freeMemoryCallback` parameters must both be non-null.   <br /><br /> To use this method, it must be called before any other Party method except for PartyManager::GetMemoryCallbacks(). This method cannot be called again for the lifetime of this process.

## Requirements

**Header:** Party.h

## See also

[PartyManager](/services/playfab/multiplayer/networking/reference/classes/PartyManager/partymanager)\
[PartyAllocateMemoryCallback](/services/playfab/multiplayer/networking/reference/callbacks/partyallocatememorycallback)\
[PartyFreeMemoryCallback](/services/playfab/multiplayer/networking/reference/callbacks/partyfreememorycallback)\
[PartyManager::GetMemoryCallbacks](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_getmemorycallbacks)


## Related topics

- [PartyManager::GetMemoryCallbacks](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_getmemorycallbacks.md)
- [PartyAllocateMemoryCallback](/services/playfab/multiplayer/networking/reference/callbacks/partyallocatememorycallback.md)
- [PartyFreeMemoryCallback](/services/playfab/multiplayer/networking/reference/callbacks/partyfreememorycallback.md)
- [PartyManager::Initialize](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_initialize.md)
- [PlayFab Party Release Notes](/services/playfab/multiplayer/networking/release-notes.md)
