The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at _CrtIsMemoryBlock.
Verifies that a specified memory block is in the local heap and that it has a valid debug heap block type identifier (debug version only).
int _CrtIsMemoryBlock( const void *userData, unsigned int size, long *requestNumber, char **filename, int *linenumber );
Pointer to the beginning of the memory block to verify.
Size of the specified block (in bytes).
Pointer to the allocation number of the block or
Pointer to the name of the source file that requested the block or
Pointer to the line number in the source file or
TRUE if the specified memory block is located within the local heap and has a valid debug heap block type identifier; otherwise, the function returns
_CrtIsMemoryBlock function verifies that a specified memory block is located within the application's local heap and that it has a valid block type identifier. This function can also be used to obtain the object allocation order number and the source file name/line number where the memory block allocation was originally requested. Passing non-NULL values for the
linenumber parameters causes
_CrtIsMemoryBlock to set these parameters to the values in the memory block's debug header, if it finds the block in the local heap. When _DEBUG is not defined, calls to
_CrtIsMemoryBlock are removed during preprocessing.
_CrtIsMemoryBlock fails, it returns
FALSE and the output parameters are initialized to default values:
lineNumber are set to 0 and
filename is set to
Because this function returns
FALSE, it can be passed to one of the _ASSERT macros to create a simple debugging error handling mechanism. The following example causes an assertion failure if the specified address is not located within the local heap:
_ASSERTE( _CrtIsMemoryBlock( userData, size, &requestNumber, &filename, &linenumber ) );
For more information about how
_CrtIsMemoryBlock can be used with other debug functions and macros, see Macros for Reporting. For information about how memory blocks are allocated, initialized, and managed in the debug version of the base heap, see CRT Debug Heap Details.
For more compatibility information, see Compatibility in the Introduction.
Debug versions of C run-time libraries only.
See the example for the _CrtIsValidHeapPointer topic.
.NET Framework Equivalent
Not applicable. To call the standard C function, use
PInvoke. For more information, see Platform Invoke Examples.