Next: Functions Prev: Implementation Up: Implementation

Backwards Compatibility

   To allow a single malloc package to be used in a given application,
provision is made for the traditional `malloc', `realloc', and `free'
functions to be implemented as special cases of the `mmalloc'
functions.  In particular, if any of the functions that expect malloc
descriptors are called with a `NULL' pointer rather than a valid malloc
descriptor, then they default to using an `sbrk' managed region.  The
`mmalloc' package provides compatible `malloc', `realloc', and `free'
functions using this mechanism internally.  Applications can avoid this
extra interface layer by simply including the following defines:

     #define malloc(size)		mmalloc ((void *)0, (size))
     #define realloc(ptr,size)	mrealloc ((void *)0, (ptr), (size));
     #define free(ptr)		mfree ((void *)0, (ptr))

or replace the existing `malloc', `realloc', and `free' calls with the
above patterns if using `#define' causes problems.

automatically generated by info2www