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

# PIXRecordMemoryFreeEvent

> PIXRecordMemoryFreeEvent

# PIXRecordMemoryFreeEvent

Records a memory freeing event.

## Syntax

```cpp theme={null}
void PIXRecordMemoryFreeEvent(  
         USHORT allocatorId,  
         void* baseAddress,  
         size_t size,  
         UINT64 metadata  
)  
```

### Parameters

*allocatorId*   <br />Type: USHORT

An ID you can use to identify groups of memory allocations in the memory profiler. For example, if you have different heaps for things such as graphics, audio, and physics, you can assign each of these categories a different allocatorID so they are easy to identify when viewing a memory capture in PIX.

*baseAddress*   <br />Type: void\*

The starting address of the memory that has been freed.

*size*   <br />Type: size\_t

The size of the memory that has been freed in bytes.

*metadata*   <br />Type: UINT64

A 64-bit unsigned integer you can use to tag a memory freeing with additional data. This extra data is displayed in PIX in a UserData column. You can use this extra data to identify the type of object within your title that has been freed at a given memory location, for example. The value passed to `PIXRecordMemoryFreeEvent` does not have to match the value passed to the corresponding call to [PIXRecordMemoryAllocationEvent](/reference/tools/pix3/functions/pixrecordmemoryallocationevent).

### Return value

Type: void

## Remarks

A PIX memory tracking event provides the data that PIX needs to display information about all memory allocations and releasings made from within the title's custom memory allocators in memory profiling captures. By providing this data, PIX will show all the same data for your custom allocators that it does for calls to `VirtualAlloc/VirtualFree` and `HeapAlloc/HeapFree`.

PIX uses the *baseAddress* and *size* parameters to locate the corresponding allocation as follows: If *baseAddress* matches the *baseAddress* passed to the corresponding call to [PIXRecordMemoryAllocationEvent](/reference/tools/pix3/functions/pixrecordmemoryallocationevent), PIX will match up the allocation and free by simply comparing the addresses. In this case, 0 can be passed for the *size* parameter. If *baseAddress* is different than the value specified in the corresponding allocation, the *size* parameter must be specified as non-zero. In this case, PIX will find the corresponding allocations using both *baseAddress* and *size*.

If there are a large number of events occurring at the same time or the system is under a heavy load, memory events can be lost by Event Tracing for Windows (ETW). Event loss will result in an incomplete analysis of data. PIX Memory Capture UI will display a warning indicating event loss.

## Requirements

**Header:** pixmemory.h

**Library:** pixevt.lib

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

## Conceptual documentation

* [ATG Systems Engagement Checklist](/build/atg-engagement/atg-systems-engagement)

## See also

[PIX custom memory allocators (NDA topic)](/tools/tools-console/pix/pix-custom-memory-allocators) [PIX API reference](/reference/tools/pix3/pix3_members)<br />[PIXRecordMemoryAllocationEvent](/reference/tools/pix3/functions/pixrecordmemoryallocationevent)<br />[PIX (NDA topic)](/tools/tools-console/pix/pix)


## Related topics

- [PIXRecordMemoryAllocationEvent](/reference/tools/pix3/functions/pixrecordmemoryallocationevent.md)
- [PIX3](/reference/tools/pix3/pix3_members.md)
- [XblPresenceRecordCloseHandle](/reference/live/xsapi-c/presence_c/functions/xblpresencerecordclosehandle.md)
- [game_chat_free_memory_callback](/reference/chat/gamechat2/functions/game_chat_free_memory_callback.md)
- [PFMultiplayerFreeMemoryCallback](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/callbacks/pfmultiplayerfreememorycallback.md)
