Guardian C Library Calls Reference Manual
heap_check (supplementary)
3-86 128833—Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
heap_check (supplementary)
The heap_check function checks the consistency of the run-time heap used by the
memory-management functions calloc, free, malloc, and realloc.
Usage Guidelines
•
If heap_check discovers an inconsistency in the run-time heap, it prints an error
message to stderr and then calls exit with the argument EXIT_FAILURE.
heap_check_always (supplementary)
The heap_check_always function controls whether the memory-management functions
calloc, free, malloc, and realloc automatically check the consistency of the run-time
heap.
switch
specifies whether to enable or disable automatic consistency checking of the
run-time heap. A nonzero value of switch enables automatic checking, and the value
zero disables automatic checking.
Usage Guidelines
•
When automatic consistency checking is enabled, the memory-management
functions listed earlier perform the consistency check by calling heap_check.
Consequently, an inconsistency discovered by automatic checking has the same
impact as one discovered by calling heap_check.
•
Enabling automatic consistency checking degrades the performance of heap
operations significantly. Thus, you should disable automatic checking after
developing and debugging your application.
#include <stdlibh>
void heap_check(void);
#include <stdlibh>
void heap_check_always(int switch);