> ## 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_ALLOC_ROUTINE 回呼

> PHEAP_TRACK_ALLOC_ROUTINE 回呼

# PHEAP\_TRACK\_ALLOC\_ROUTINE 回呼

代表堆積配置的追蹤回呼函式。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
void PHEAP_TRACK_ALLOC_ROUTINE(  
         HANDLE Heap,  
         DWORD Flags,  
         SIZE_T Size,  
         PVOID Addr  
)  
```

<a id="parametersSection" />

### 參數

*Heap*   \
類型：HANDLE

配置記憶體區塊之堆積的控制代碼。

*Flags*   \
類型：DWORD

傳遞給 [HeapAlloc](https://learn.microsoft.com/windows/desktop/api/heapapi/nf-heapapi-heapalloc) 的堆積配置旗標。

*Size*   \
類型：SIZE\_T

為記憶體區塊配置的位元組數。

*Addr*   \
類型：PVOID

已配置之記憶體區塊的位址。

<a id="retvalSection" />

### 傳回值

類型：void

無。

<a id="remarksSection" />

## 備註

可以實作此回呼函式，以追蹤何時從 Win32 堆積配置記憶體區塊。實作後，您必須呼叫 [XMemSetWin32HeapTrackingHooks](/zh-TW/reference/system/xmem/functions/xmemsetwin32heaptrackinghooks) 來註冊已實作的回呼函式。之後，在呼叫 `HeapAlloc` 從 Win32 堆積配置記憶體區塊後，就會叫用此回呼函式。如需實作此回呼函式的詳細資訊，請參閱 `XMemSetWin32HeapTrackingHooks` 的[備註](/zh-TW/reference/system/xmem/functions/xmemsetwin32heaptrackinghooks#remarksSection)一節。

<a id="requirementsSection" />

## 需求

**標頭：** xmem.h

**程式庫：** xmem.lib

**支援的平台：** XBOX One 系列主機和 XBOX Series 主機

<a id="seealsoSection" />

## 另請參閱

[診斷與記憶體追蹤](/zh-TW/build/console-features/memory/system-memory-diagnostics)\
[XMemCreateWin32Heap](/zh-TW/reference/system/xmem/functions/xmemcreatewin32heap)\
[PHEAP\_TRACK\_FREE\_ROUTINE](/zh-TW/reference/system/xmem/functions/pheap_track_free_routine)\
[PHEAP\_TRACK\_REALLOC\_ROUTINE](/zh-TW/reference/system/xmem/functions/pheap_track_realloc_routine)\
[XMem](/zh-TW/reference/system/xmem/xmem_members)


## Related topics

- [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)
- [PHEAP_TRACK_REALLOC_ROUTINE callback](/reference/system/xmem/functions/pheap_track_realloc_routine.md)
- [XMemSetWin32HeapTrackingHooks](/reference/system/xmem/functions/xmemsetwin32heaptrackinghooks.md)
