XMemSetWin32HeapTrackingHooks
Sets tracking callback functions for memory allocation, reallocation, and deallocation of Win32 heaps.Syntax
Parameters
AllocRoutine _In_Type: PHEAP_TRACK_ALLOC_ROUTINE A pointer to a tracking callback function for memory allocation. ReAllocRoutine _In_
Type: PHEAP_TRACK_REALLOC_ROUTINE A pointer to a tracking callback function for memory reallocation. FreeRoutine _In_
Type: PHEAP_TRACK_FREE_ROUTINE A pointer to a tracking callback function for memory deallocation.
Return value
Type: VOID None.Remarks
This function allows you to track Win32 heap memory allocation, reallocation, and deallocation by specifying callback functions that are invoked by the GDK memory manager when those heap memory operations are called. For more information about tracking memory operations, see Diagnostics and memory tracking.The CRT makes several heap allocations during initialization and entry points of DLLs/EXEs linked with the CRT. Since this initialization is a pre-requisite for execution of any code within these modules, it is not typically possible to call XMemSetWin32HeapTrackingHooks prior to all heap allocations occurring. Callback code should be aware of this behavior and handle it accordingly.
- To track allocation when
HeapAllocis invoked, implement a PHEAP_TRACK_ALLOC_ROUTINE callback function. - To track reallocation when
HeapReAllocis invoked, implement a PHEAP_TRACK_REALLOC_ROUTINE callback function. - To track deallocation when
HeapFreeis invoked, implement a PHEAP_TRACK_FREE_ROUTINE callback function.
NULL for the appropriate heap memory operations you want to stop tracking.
The following example defines tracking callback functions, then uses the XMemSetWin32HeapTrackingHooks function to set and clear hooks to those tracking callback functions.
Requirements
Header: xmem.h Library: xmem.lib Supported platforms: XBOX One family consoles and XBOX Series consolesSee also
MemoryXMem
