INtime SDK Help
_CrtIsValidHeapPointer
INtime SDK v7 > About INtime > Other system libraries > Heaps and memory pools > Using the Debug Heap > Using Macros for verification and reporting > _CrtIsValidHeapPointer

Verifies that the heap contains the specified pointer (debug version only).

int _CrtIsValidHeapPointer (
    const void * _HeapPtr
);

Parameters

_HeapPtr
Pointer to the beginning of an allocated memory block.

Remarks

Use _CrtIsValidHeapPointer to ensure that a specific memory address is within the heap. When _DEBUG is not defined, preprocessing removes calls to _CrtIsValidHeapPointer.

Because this function returns TRUE or FALSE, you can pass it 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(
    _CrtIsValidHeapPointer(
        userData 
    ) 
);

For more information about how to use _CrtIsValidHeapPointer with other debug functions and macros, see Using Macros for Verification and Reporting. 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.

Return Values

TRUE
Success; the specified pointer is in the heap.
FALSE
Failure. The function sets errno to one of these values:
EINVAL _HeapPtr is invalid.

Requirements

Versions Defined in Include Link to
INtime 3.13 intime/rt/include/crtdbg.h crtdbg.h clib.lib
   
See Also