> ## 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\_\
Type: size\_t

実行する割り当てのサイズ。この値が 0 になることはありません。

*memoryTypeId*   \_In\_\
Type: 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](/ja-jp/reference/chat/gamechat2/classes/chat_manager/methods/chat_manager_set_memory_callbacks.md)
- [chat_manager::get_memory_callbacks](/ja-jp/reference/chat/gamechat2/classes/chat_manager/methods/chat_manager_get_memory_callbacks.md)
- [game_chat_free_memory_callback](/ja-jp/reference/chat/gamechat2/functions/game_chat_free_memory_callback.md)
- [GameChat2 メンバー](/ja-jp/reference/chat/gamechat2/gamechat2_members.md)
- [PFMultiplayerAllocateMemoryCallback](/ja-jp/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/callbacks/pfmultiplayerallocatememorycallback.md)
