Next: allocators api, Up: allocators [Contents][Index]
Type of struct representing a memory allocator. It has the following fields:
ccmem_allocator_methods_t const * const methodsPointer to a table of methods representing the behaviour of this allocator.
Instances of this type are meant to be wrapped in other struct to add state to the
allocator. For example:
typedef struct my_allocator_t my_allocator_t;
struct my_allocator_t {
ccmem_allocator_t base;
void * state;
}
Type of struct representing the methods of a memory allocator. It has the following fields:
ccmem_malloc_fun_t * const mallocPointer to function that allocates memory in a way similar to the standard malloc().
ccmem_realloc_fun_t * const reallocPointer to function that reallocates memory in a way similar to the standard realloc().
ccmem_calloc_fun_t * const callocPointer to function that allocates memory in a way similar to the standard calloc().
ccmem_free_fun_t * const freePointer to function that releases memory in a way similar to the standard free().
Type of function that allocates memory in a way similar to the standard malloc(). The
function uses the allocator A. If an error occurs: an exception is raised by jumping to the
location L. Functions of this type never return NULL.
Type of function that reallocates memory in a way similar to the standard realloc(). The
function uses the allocator A. Only memory blocks allocated by A can be reallocated by
this function. If an error occurs: an exception is raised by jumping to the location L.
Functions of this type never return NULL.
Type of function that allocates memory in a way similar to the standard calloc(). The
function uses the allocator A. If an error occurs: an exception is raised by jumping to the
location L. Functions of this type never return NULL.
Type of function that releases memory in a way similar to the standard free(). The function
uses the allocator A. Only memory allocated using the allocator A can be released with
this function.
Functions of this type must not raise exceptions. If an allocator fails to release memory: it should mark itself as “in invalid state” and fail to further allocate memory.
Next: allocators api, Up: allocators [Contents][Index]
This document describes version 0.2.2-devel.3 of CCMemory.