background image
Bionic Buffalo Tech Note #102: Using the Ivory Coast Memory Management Routines
Before such a termination, an appropriate error message will be printed. This eliminates
the need to check returned pointers for 
: when this flag is set, the routine will never
return a 
 will cause the library to terminate the application
in case it detects corruption in the memory allocation data structures. When corruption is
detected, then there probably is  a programming bug, and the error probably is not
recoverable. Termination is usually the only reasonable option under normal
circumstances. The only reasons an application might set this flag are to perform some
special cleanup operations before terminating itself, or during development to track down
the cause of the error.
 will cause the library to place a canary
immediately following the user buffer. No software should ever write to the canary
location. When the block is released, or at some other time as requested by special
subroutine call (
), the canary value will be checked. If
the canary value has changed since allocation, then there is a strong likelihood that the
application has written beyond the end of its buffer, and memory is presumed corrupted.
Once allocated, a block may be reallocated using
    civ_status_T    civ_memory_allocate
                            ( void           ** pointer,
                            size_t              new_size,
                            civ_flags_T         flags ) ;
This causes a new block to be allocated in the same region as the original block, and the contents of the
old block will be copied to the new block. The old pointer is overwritten by the new pointer, and the
old block is released. This is similar to calling 
, except for the features defined by the
flags. The new block may be larger or smaller than the old block. If the block is expanded and
 is used, then the additional area is zeroed.
Memory is returned using
    civ_status_T    civ_memory_release
                            ( void            * pointer,
                            civ_flags_T         flags ) ;
In all of the above calls, the success or failure of the call is indicated by the 
value. Normally, the only reasons for failure are corrupted memory, bad parameters, or insufficient
Obtaining and Modifying User Flags
Page 4 of 6