INtime SDK Help
INtime SDK v7.1 > 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


Pointer to the beginning of an allocated memory block.


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:


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

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


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