farheapcheck
raw OCR
Checks and verifies the far heap.
Defined in header <alloc.h>
Syntax
#include <alloc.h>
int farheapcheck(void);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ |
Remarks
farheapcheck walks through the far heap and examines each block, checking its pointers, size, and other critical attributes.
Return value
The return value is less than zero for an error and greater than zero for success.
| _HEAPEMPTY | is returned if there is no heap (value 1). |
| HEAPOK | is returned if the heap is verified (value 2). |
| _HEAPCORRUPT | is returned if the heap has been corrupted (value -1). |
See also
Example
#include <stdio.h>
#include <alloc.h>
#define NUM_PTRS 10
#define NUM_BYTES 16
int main(void)
{
char far *array[ PTRS
int i;
for( i = 0; i < NUM_PTRS; i++ )
array[ i ] = (char far *) farmalloc( NUM_BYTES
for( i = 0; i < NUM_PTRS; i += 2 )
farfree( array [ i ] );
if( farheapcheck 0 == _HEAPCORRUPT )
printf( "Heap is corrupted. \n" );
else
printf( "Heap is OK.\n" );
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/alloc.h/farheapcheck/
· short form /3.1/farheapcheck/