> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# cleanup

> chat_manager::cleanup

# chat\_manager::cleanup

立即回收与聊天实例关联的所有资源。

## 语法

```cpp theme={null}
void cleanup(  
)  
```

### 参数

无。

### 返回值

类型：void

无。

## 备注

此方法立即回收与此聊天实例关联的所有资源。当应用不再需要使用 Game Chat 2 进行通信时，或者当应用挂起时，调用此方法以释放分配给已初始化聊天实例的资源。每次对 [chat\_manager::initialize](https://docs.xbox.com/zh-CN/reference/chat/gamechat2/classes/chat_manager/methods/chat_manager_initialize.md) 方法的调用都必须有一次对应此方法的调用。有关初始化和清理聊天实例的详细信息，请参阅[使用 Game Chat 2 C++ API](https://docs.xbox.com/zh-CN/services/xbox-services/multiplayer/chat/game-chat2/using-game-chat-2.md)。

## 要求

**头文件：** GameChat2.h

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## 另请参阅

[Game Chat 2 简介](https://docs.xbox.com/zh-CN/services/xbox-services/multiplayer/chat/game-chat2/game-chat-2-intro.md)\
[chat\_manager](https://docs.xbox.com/zh-CN/reference/chat/gamechat2/classes/chat_manager/chat_manager.md)


## Related topics

- [HCCleanup](https://docs.xbox.com/zh-CN/reference/live/httpclient/httpclient/functions/hccleanup.md)
- [HCTraceCleanup](https://docs.xbox.com/zh-CN/reference/live/httpclient/trace/functions/hctracecleanup.md)
- [HCCleanupAsync](https://docs.xbox.com/zh-CN/reference/live/httpclient/httpclient/functions/hccleanupasync.md)
- [XblCleanupAsync](https://docs.xbox.com/zh-CN/reference/live/xsapi-c/xbox_live_global_c/functions/xblcleanupasync.md)
- [PartyManager::Cleanup](https://docs.xbox.com/zh-CN/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_cleanup.md)
