Export (0) Print
Expand All
div
Expand Minimize
This topic has not yet been rated - Rate this topic

_CrtSetDumpClient

Installs an application-defined function to dump _CLIENT_BLOCK type memory blocks (debug version only).

_CRT_DUMP_CLIENT _CrtSetDumpClient( 
   _CRT_DUMP_CLIENT dumpClient 
);

Parameter

dumpClient
New client-defined memory dump function to hook into the C run-time debug memory dump process.

Return Value

Returns the previously defined client block dump function.

Remarks

The _CrtSetDumpClient function allows the application to hook its own function to dump objects stored in _CLIENT_BLOCK memory blocks into the C run-time debug memory dump process. As a result, every time a debug dump function such as _CrtMemDumpAllObjectsSince or _CrtDumpMemoryLeaks dumps a _CLIENT_BLOCK memory block, the application's dump function will be called as well. _CrtSetDumpClient provides an application with an easy method for detecting memory leaks in and validating or reporting the contents of data stored in _CLIENT_BLOCK blocks. When _DEBUG is not defined, calls to _CrtSetDumpClient are removed during preprocessing.

The _CrtSetDumpClient function installs the new application-defined dump function specified in dumpClient and returns the previously defined dump function. An example of a client block dump function is as follows:

void DumpClientFunction( void *userPortion, size_t blockSize );

The userPortion argument is a pointer to the beginning of the user data portion of the memory block and blockSize specifies the size of the allocated memory block in bytes. The client block dump function must return void. The pointer to the client dump function that is passed to _CrtSetDumpClient is of type _CRT_DUMP_CLIENT, as defined in CRTDBG.H:

typedef void (__cdecl *_CRT_DUMP_CLIENT)( void *, size_t );

For an example of how to implement an application-defined dump function, see crt_dbg2 Sample: C Run-Time Debugging Hook Functions. For more information about functions that operate on _CLIENT_BLOCK type memory blocks, see Client Block Hook Functions. The function _CrtReportBlockType can be used to return information on block types and subtypes.

Requirements

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

For additional compatibility information, see Compatibility in the Introduction.

Libraries

Debug versions of C run-time libraries only.

Example

For a sample of how to use _CrtSetDumpClient, see crt_dbg2.

See Also

Debug Functions | _CrtReportBlockType | Run-Time Routines and .NET Framework Equivalents

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.