This documentation is archived and is not being maintained.


Calls an application-supplied function for all _CLIENT_BLOCK types in the heap (debug version only).

void _CrtDoForAllClientObjects( 
   void (* pfn )(void *, void * ),
   void *context


Pointer to the application-supplied function call-back function. The first parameter to this function points to the data. The second parameter is the context pointer that is passed in to the call to _CrtDoForAllClientObjects.
Pointer to the application-supplied context to pass to the application-supplied function.


The _CrtDoForAllClientObjects function searches the heap's linked list for memory blocks with the _CLIENT_BLOCK type and calls the application-supplied function when a block of this type is found. The found block and the context parameter are passed as arguments to the application-supplied function. During debugging, an application can track a specific group of allocations by explicitly calling the debug heap functions to allocate the memory and specifying that the blocks be assigned the _CLIENT_BLOCK block type. These blocks can then be tracked separately and reported on differently during leak detection and memory state reporting.

If the _CRTDBG_ALLOC_MEM_DF bit field of the _crtDbgFlag flag is not turned on, _CrtDoForAllClientObjects immediately returns. When _DEBUG is not defined, calls to _CrtDoForAllClientObjects are removed during preprocessing.

For more information about the _CLIENT_BLOCK type and how it can be used by other debug functions, see Types of Blocks on the Debug Heap. For information about how memory blocks are allocated, initialized, and managed in the debug version of the base heap, see Memory Management and the Debug Heap.


Routine Required header Compatibility
_CrtDoForAllClientObjects <crtdbg.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.


Debug versions of C run-time libraries only.


For a sample of how to use _CrtDoForAllClientObjects, see dfacobjs.

See Also

Debug Functions | _CrtSetDbgFlag | Heap State Reporting Functions | _CrtReportBlockType | Run-Time Routines and .NET Framework Equivalents