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

> Immediately reclaims all resources associated with all Party library objects.

Immediately reclaims all resources associated with all Party library objects.

## Syntax

```cpp theme={null}
PartyError Cleanup(  
)  
```

### Parameters

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

If local users were participating in a PartyNetwork, they're removed ungracefully (it appears to remote devices as if network connectivity to this device is lost), so best practice is to call [PartyNetwork::LeaveNetwork()](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_leavenetwork) first on all networks returned from a call to [GetNetworks()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_getnetworks) and wait for the corresponding [PartyLeaveNetworkCompletedStateChange](/services/playfab/multiplayer/networking/reference/structs/partyleavenetworkcompletedstatechange) to have the local users exit any existing PartyNetworks gracefully. <br /><br /> This method isn't thread-safe and may not be called concurrently with other non-static Party library methods. After calling this method, all Party library state is invalidated.   <br /><br /> Titles using the Microsoft Game Core version of the Party library must listen for app state notifications via the RegisterAppStateChangeNotification API. When the app is suspended, the title must call PartyManager::Cleanup(). When the app is resumed, the title must wait for the Game Core networking stack to be ready and then reinitialize the Party library by calling PartyManager::Initialize().   <br /><br /> Every call to [Initialize()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_initialize) should have a corresponding Cleanup() call.

## Requirements

**Header:** Party.h

## See also

[PartyManager](/services/playfab/multiplayer/networking/reference/classes/PartyManager/partymanager)\
[PartyManager::Initialize](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_initialize)\
[PartyNetwork::LeaveNetwork](/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_leavenetwork)\
[PartyManager::GetNetworks](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_getnetworks)


## Related topics

- [PartyManager::Initialize](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_initialize.md)
- [Azure PlayFab Party](/build/console-features/networking/game-mesh/playfab-party-intro-networking.md)
- [PlayFab Party Release Notes](/services/playfab/multiplayer/networking/release-notes.md)
- [PartyManager](/services/playfab/multiplayer/networking/reference/classes/PartyManager/partymanager.md)
- [PartyManager::SetWorkMode](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_setworkmode.md)
