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

# PHEAP_TRACK_REALLOC_ROUTINE callback

> PHEAP_TRACK_REALLOC_ROUTINE callback

# PHEAP\_TRACK\_REALLOC\_ROUTINE callback

Represents a tracking callback function for heap reallocation.

<a id="syntaxSection" />

## Syntax

```cpp theme={null}
void PHEAP_TRACK_REALLOC_ROUTINE(  
         HANDLE Heap,  
         DWORD Flags,  
         SIZE_T Size,  
         PVOID OldAddr,  
         PVOID NewAddr  
)  
```

<a id="parametersSection" />

### Parameters

*Heap*   \
Type: HANDLE

The handle to the heap from which the memory block was reallocated.

*Flags*   \
Type: DWORD

The heap reallocation options passed to [HeapReAlloc](https://learn.microsoft.com/windows/desktop/api/heapapi/nf-heapapi-heaprealloc).

*Size*   \
Type: SIZE\_T

The new size of the memory block, in bytes.

*OldAddr*   \
Type: PVOID

The original address of the memory block that `HeapReAlloc` reallocated.

*NewAddr*   \
Type: PVOID

The new address of the reallocated memory block.

<a id="retvalSection" />

### Return value

Type: void

None.

<a id="remarksSection" />

## Remarks

This callback function can be implemented to track when a memory block is reallocated from a Win32 heap. Once implemented, you must register the implemented callback function by calling [XMemSetWin32HeapTrackingHooks](/reference/system/xmem/functions/xmemsetwin32heaptrackinghooks). The callback function is then invoked after `HeapReAlloc` is called to reallocate a previously-allocated memory block from a Win32 heap. For more information about implementing this callback function, see the [Remarks](/reference/system/xmem/functions/xmemsetwin32heaptrackinghooks#remarksSection) section of `XMemSetWin32HeapTrackingHooks`.

<a id="requirementsSection" />

## Requirements

**Header:** xmem.h

**Library:** xmem.lib

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

<a id="seealsoSection" />

## See also

[Diagnostics and memory tracking](/build/console-features/memory/system-memory-diagnostics)\
[XMemCreateWin32Heap](/reference/system/xmem/functions/xmemcreatewin32heap)\
[PHEAP\_TRACK\_ALLOC\_ROUTINE](/reference/system/xmem/functions/pheap_track_alloc_routine)\
[PHEAP\_TRACK\_FREE\_ROUTINE](/reference/system/xmem/functions/pheap_track_free_routine)\
[XMem](/reference/system/xmem/xmem_members)


## Related topics

- [XMemSetWin32HeapTrackingHooks](/reference/system/xmem/functions/xmemsetwin32heaptrackinghooks.md)
- [PHEAP_TRACK_ALLOC_ROUTINE callback](/reference/system/xmem/functions/pheap_track_alloc_routine.md)
- [PHEAP_TRACK_FREE_ROUTINE callback](/reference/system/xmem/functions/pheap_track_free_routine.md)
- [XMEMALLOC_ROUTINE callback](/reference/system/xmem/functions/xmemalloc_routine.md)
- [XMEMFREE_ROUTINE callback](/reference/system/xmem/functions/xmemfree_routine.md)
