Bionic Buffalo Tech Note #102: Using the Ivory Coast Memory Management Routines
When canaries are requested, then the library also allocates a suffix after the user area. In the current
implementation, the suffix consists only of the canary. (In future implementations, planned for typed or
tagged memory, the suffix may also contain type data or other varying length information.)
Allocating and Releasing Memory
To obtain memory, the application calls
( size_t size,
void ** pointer,
civ_flags_T flags ) ;
is the amount of memory requested by the application. It does not include any prefix or
is the pool from which memory is to be allocated. In the default implementation, the only
meaningful region is
, which obtains the buffer using
other versions, special regions may be defined. For example, a driver sharing a memory buffer with a
network card might define
Currently, there are eight user flags and five library flags defined.
The user flags are the least significant eight bits of the
, and may be set in any combination
entirely at the discretion of the application. The user flags are kept with the block (in the prefix), and
may be retrieved at any later time by
. The application might (for
example) use them to remember the purpose or type of data in a block, the task or program which
allocated the block, or whether the block was locked or otherwise put to some special use.
The library flags modify the behaviour of the memory allocation API.
causes the library to zero the new block
before returning it to the caller. This is similar to the effect of using
will cause the library to zero the block when
(and if) it is finally released. The main intended purpose for this is security: if the buffer
will be used to contain confidential information, then zeroing it will make it more difficult
for an attacker to acquired the contents.
will cause the library to terminate the
process by calling
in case insufficient memory is available to satisfy the request.
Page 3 of 6