Borland C++ reference

heapchecknode

raw OCR

Checks and verifies a single node on the heap.

Defined in header <alloc.h>

Syntax

#include <alloc.h>
int heapchecknode(void  *node);

Portability

DOSUNIXWindowsANSI CC++ only
■

Remarks

If a node has been freed and heapchecknode is called with a pointer to

the freed block, heapchecknode can return BADNODErather than the
expected FREEENTRY.This is because adjacent free blocks on the heap

are merged, and the block in question no longer exists.

Return value

The return value is less than zero for an error and greater than zero for success. The return values and their meaning is as follows:

_HEAPEMPTYno heap (value 1).
_HEAPCORRUPTheap has been corrupted (value -1).
_BADNODEnode could not be found (value -2).
_FREEENTRYnode is a free block (value 3).
_USEDENTRYnode is a used block (value 4).

See also

  • farheapchecknode
  • #include
  • <stdio.h>
  • #include
  • <alloc.h>
  • Mefine
  • NUM_PTRS
  • 10
  • ttdefine
  • NUM_BYTES
  • 16
  • int
  • main
  • {
  • char
  • *array[
  • NUM_PTRS
  • int
  • i;
  • for
  • array[
  • i
  • ]
  • =
  • malloc
  • free;
  • for
  • {
  • printf;
  • switch
  • )'
  • {
  • case
  • _HEAPEMPTY:
  • printf;
  • break;
  • case
  • _HEAPCORRUPT:
  • printf;
  • break;
  • case
  • _BADNODE:
  • printf;
  • break;
  • case
  • _FREEENTRY:
  • printf;
  • break;
  • case
  • _USEDENTRY:
  • printf;
  • break;
  • default:
  • printf;
  • break;
  • }
  • return
  • 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.