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

Game Chat 라이브러리가 새 메모리 버퍼를 동적으로 할당해야 할 때마다 호출되는 콜백입니다.

## 구문

```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
    );
```

### 매개 변수

*size*   \_In\_\
형식: size\_t

수행할 할당의 크기입니다. 이 값은 절대 0이 되지 않습니다.

*memoryTypeId*   \_In\_\
형식: uint32\_t

지정된 크기의 할당된 메모리 블록에 대한 포인터이거나, 할당에 실패한 경우 null 포인터입니다.

## 설명

이 콜백은 chat\_manager::set\_memory\_callbacks() 메서드를 사용하여 선택적으로 설치됩니다.

콜백은 지정된 크기의 연속된 메모리 블록에 대한 포인터를 할당하고 반환해야 하며, 이 블록은 앱의 해당 [game\_chat\_free\_memory\_callback](/reference/chat/gamechat2/functions/game_chat_free_memory_callback)이 호출되어 해제될 때까지 유효한 상태로 유지되어야 합니다.
이것이 불가능한 경우 콜백은 할당을 실패시키기 위해 null 포인터를 반환해야 합니다. 메모리 할당 실패는
때때로 무해한 것으로 간주되지만 일반적으로 현재의 Game Chat 라이브러리 작업이 실패하게 됩니다.

## 요구 사항

**헤더:** GameChat2.h

**지원 플랫폼:** Windows, XBOX One 제품군 콘솔 및 XBOX Series 콘솔

## 함께 보기

[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](/ko/reference/chat/gamechat2/classes/chat_manager/methods/chat_manager_set_memory_callbacks.md)
- [chat_manager::get_memory_callbacks](/ko/reference/chat/gamechat2/classes/chat_manager/methods/chat_manager_get_memory_callbacks.md)
- [game_chat_free_memory_callback](/ko/reference/chat/gamechat2/functions/game_chat_free_memory_callback.md)
- [GameChat2 멤버](/ko/reference/chat/gamechat2/gamechat2_members.md)
- [PFMultiplayerAllocateMemoryCallback](/ko/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/callbacks/pfmultiplayerallocatememorycallback.md)
