Memory allocation and deallocation Interface class. More...
|AllocatorIntf (AllocatorIntf_Malloc malloc, AllocatorIntf_Realloc realloc, AllocatorIntf_Free free)|
|Create an instance of a memory allocation class. |
|void *||malloc (size_t *size)|
|Returns pointer to uninitialized newly-allocated space for an object of size "size", or NULL on error. |
|void *||realloc (void *p, size_t *size)|
|Returns pointer to newly-allocated space for an object of size "size", initialized, to minimum of old and new sizes, to existing contents of p (if non-null), or NULL on error. |
|void||free (void *p)|
|Deallocates space to which it points. |
|static AllocatorIntf *||getDefault (void)|
|Returns a pointer to a predefined AllocatorIntf class. |
Memory allocation and deallocation Interface class.
This abstract interface class is used by some of the Barracuda classes when allocating memory. The reason for using an interface class and not directly calling the global functions baMalloc(), baRealloc() and baFree() is to provide a finer control of allocated memory. For example, an implementation of the AllocatorIntf can work with blocks of memory allocated from static memory. Implementing realloc is optional and can be set to NULL if not implemented.