Media:

DDS_HEAP is used to validate dds malloc and free usage. Validation is turned on by defining DDS_HEAP_CHECK, and recompiling DDS malloc.c, calloc.c, and realloc.c (This is currently turned on). All blocks are validated whenever the heap is changed and run-time check is controlled by specifying "dds_debug=" to include "dbg_heap", "dbg_alloc", "dbg_all" or "dbg_call".

The size of each "user" buffer is increased for checks. Three copies of DDS_HEAP exist for each active block.

  1. immediately before the "user" buffer
  2. immediately after the "user" buffer
  3. within the dds_heap "stack"

(1) and (2) are used to detect "user" buffer overruns. If the block is freed, (1) and (2) are discarded and the "size" of (3) is reset to zero.

DDS_HEAP_CREEP is the number of bytes needed for one DDS_HEAP struct, rounded up to nominal alignment.

Structures:
    DDS_HEAP - heap validation descriptor defined in dds_util.h


Globals:
    DDS_STACK dds_heap; /* stack of heap structures */


Files:
    f_xxx.c     - Fortran API Routines
                     f_malloc8.c f_malloc.c f_realloc8.c f_realloc.c 
                     f_calloc8.c f_calloc.c f_free.c f_memuse.c
    c_xxx.c     - "C" API Routines
                     c_malloc.c c_realloc.c c_calloc.c c_free.c c_memuse.c 
    malloc.c    - Malloc memory with error detection and aborting
    zalloc.c    - Malloc and clear memory with error detection and aborting
    realloc.c   - Realloc memory with error detection and aborting
    free.c      - Free memory with NULL pointer check
    heapcheck.c - Validate dds heap blocks via either allocation, freeing
                  or explicit cdds_check call as controlled at runtime by
                  "dds_debug" fields.
    alloca.c    - Allocate automatically reclaimed memory