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

# AppCaptureRegisterMetadataPurged

> AppCaptureRegisterMetadataPurged

# AppCaptureRegisterMetadataPurged

Register an event handler for meta data purge events.

## Syntax

```cpp theme={null}
HRESULT XAppCaptureRegisterMetadataPurged(  
         XTaskQueueHandle queue,  
         void* context,  
         XAppCaptureMetadataPurgedCallback* callback,  
         XTaskQueueRegistrationToken* token  
)  
```

### Parameters

*queue*   \_In\_opt\_\
Type: XTaskQueueHandle

Async queue to handle asynchronous work. If not assigned a default async queue will be created.

*context*   \_In\_\
Type: void\*

Information to be passed to the callback function. Usually the calling object.

*callback*   \_In\_\
Type: XAppCaptureMetadataPurgedCallback\*

Callback function to be called after the asynchronous work is finished.

*token*   \_Out\_\
Type: XTaskQueueRegistrationToken\*

Token identifying the event handler.

### Return value

Type: HRESULT

Function result.

## Remarks

<Note>This function isn't safe to call on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

Because historical app capture is supported, the system accumulates metadata written with **AppCaptureMetadataWriter** even when not actively capturing or broadcasting. When, for example, a capture of the previous 30 seconds is written to a video file on disk, the metadata associated with the recorded time window is included in the file. The system imposes a limit on the storage space that is allocated per app for storing accumulated metadata. You can get the currently available storage space by checking the RemainingStorageBytesAvailable property.\
When the all of the allotted space has been filled, the system will begin purging metadata using the [XAppCaptureMetadataPriority](/reference/system/xappcapture/enums/xappcapturemetadatapriority) value, specified when the metadata items were written, and the age of each item in order to delete the oldest, least important data first. When this occurs, the **MetadataPurged** event is raised. In response to this event, you may choose to reduce the amount of metadata your app is writing, but this is not required.

## Requirements

**Header:** XAppCapture.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[GameDVR Overview](/build/console-features/game-dvr/gamedvr-broadcast)\
[XAppCapture Members](/reference/system/xappcapture/xappcapture_members)\
[XAppCaptureUnRegisterMetadataPurged](/reference/system/xappcapture/functions/xappcaptureunregistermetadatapurged)


## Related topics

- [XAppCaptureUnRegisterMetadataPurged](/reference/system/xappcapture/functions/xappcaptureunregistermetadatapurged.md)
- [XAppCaptureMetadataPurgedCallback](/reference/system/xappcapture/functions/xappcapturemetadatapurgedcallback.md)
- [XAppCapture](/reference/system/xappcapture/xappcapture_members.md)
- [XAppCaptureMetadataPriority](/reference/system/xappcapture/enums/xappcapturemetadatapriority.md)
- [XAppCaptureMetadataRemainingStorageBytesAvailable](/reference/system/xappcapture/functions/xappcapturemetadataremainingstoragebytesavailable.md)
