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

# game_chat_allocate_memory_callback

> game_chat_allocate_memory_callback

# game\_chat\_allocate\_memory\_callback

Devolución de llamada que se invoca cada vez que la biblioteca de Game Chat debe asignar dinámicamente un nuevo búfer de memoria.

## Sintaxis

```cpp theme={null}
typedef
_Ret_maybenull_
_Post_writable_byte_size_(size) void *
(game_chat_callback * game_chat_allocate_memory_callback)(
    _In_ size_t size,
    _In_ uint32_t memoryTypeId
    );
```

### Parámetros

*size*   \_In\_\
Tipo: size\_t

El tamaño de la asignación que se va a realizar. Este valor nunca será cero.

*memoryTypeId*   \_In\_\
Tipo: uint32\_t

Un puntero a un bloque de memoria asignado del tamaño especificado, o un puntero nulo si la asignación falló.

## Comentarios

Esta devolución de llamada se instala opcionalmente mediante el método chat\_manager::set\_memory\_callbacks().

La devolución de llamada debe asignar y devolver un puntero a un bloque de memoria contiguo del tamaño especificado que
permanecerá válido hasta que se invoque la devolución de llamada [game\_chat\_free\_memory\_callback](/reference/chat/gamechat2/functions/game_chat_free_memory_callback) correspondiente de la aplicación para liberarlo.
Si esto no es posible, la devolución de llamada debe devolver un puntero nulo para hacer fallar la asignación. Los errores de asignación de memoria
a veces se consideran benignos, pero normalmente provocarán errores en las operaciones actuales de la biblioteca de Game Chat.

## Requisitos

**Encabezado:** GameChat2.h

**Plataformas compatibles:** Windows, consolas de la familia XBOX One y consolas XBOX Series

## Consulte también

[Miembros de GameChat2](/reference/chat/gamechat2/gamechat2_members)\
[chat\_manager::get\_memory\_callbacks](/reference/chat/gamechat2/classes/chat_manager/methods/chat_manager_get_memory_callbacks)\
[chat\_manager::set\_memory\_callbacks](/reference/chat/gamechat2/classes/chat_manager/methods/chat_manager_set_memory_callbacks)


## Related topics

- [chat_manager::set_memory_callbacks](/es/reference/chat/gamechat2/classes/chat_manager/methods/chat_manager_set_memory_callbacks.md)
- [chat_manager::get_memory_callbacks](/es/reference/chat/gamechat2/classes/chat_manager/methods/chat_manager_get_memory_callbacks.md)
- [game_chat_free_memory_callback](/es/reference/chat/gamechat2/functions/game_chat_free_memory_callback.md)
- [GameChat2 members](/es/reference/chat/gamechat2/gamechat2_members.md)
- [PFMultiplayerAllocateMemoryCallback](/es/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/callbacks/pfmultiplayerallocatememorycallback.md)
