Classes | |
struct | Gan_MemoryStack |
Structure to hold state of stack memory blocks. More... | |
Defines | |
#define | obj_type int x |
#define | TM_TEST_MAGIC 1 |
#define | TM_MAGIC_NUMBER 0x2f3ee7b1 |
Typedefs | |
typedef void(* | Gan_FreeFunc )(void *) |
Generic free function type. | |
typedef void *(* | Gan_CopyFunc )(void *) |
Generic copy function type. | |
typedef double | Gan_BigType |
Big C type for byte alignment. | |
typedef Gan_MemoryStack | Gan_MemoryStack |
Structure to hold state of stack memory blocks. | |
Functions | |
void | gan_free_va (void *ptr,...) |
Frees a NULL terminated variable argument list of memory blocks. | |
void * | gan_malloc_object (TYPE obj_type) |
Macro: Allocate an object of a specific type using malloc() . | |
void * | gan_malloc_array (TYPE obj_type, unsigned size) |
Macro: Allocate an array of objects of a specific type using malloc() . | |
void * | gan_realloc_array (TYPE obj_type, void *ptr, unsigned size) |
Macro: Reallocate an array of objects using realloc() . | |
Gan_MemoryStack * | gan_memory_stack_form (Gan_MemoryStack *ms, int nblocks, size_t bsize) |
Initialise temporary memory allocation structure. | |
void * | gan_ms_malloc (Gan_MemoryStack *ms, size_t size) |
Temporary memory allocation routine, faster than malloc(). | |
void | gan_ms_free (Gan_MemoryStack *ms, void *ptr) |
Temporary memory free routine. | |
void | gan_ms_free_va (Gan_MemoryStack *ms, void *ptr,...) |
Frees a list of temporaray blocks terminated by NULL . | |
void | gan_memory_stack_free (Gan_MemoryStack *ms) |
Frees all temporary memory. | |
void | gan_memory_stack_clean (Gan_MemoryStack *ms) |
Frees unused temporary memory. | |
size_t | gan_memory_stack_total (Gan_MemoryStack *ms) |
Returns the total temporary memory currently allocated. | |
Gan_MemoryStack * | gan_memory_stack_alloc (int nblocks, size_t bsize) |
Macro: Allocate and initialise temporary memory allocation structure. | |
void * | gan_ms_malloc_object (Gan_MemoryStack *ms, TYPE obj_type) |
Macro: Dynamically allocate one item of a specific type with "stack" memory. | |
void * | gan_ms_malloc_array (Gan_MemoryStack *ms, TYPE obj_type, size_t size) |
Macro: Dynamically allocate n items of a specific type with "stack" memory. |
|
Frees a
free() to free each memory block in the list of pointers starting with ptr and ending with NULL .
|
|
Macro: Allocate an array of objects of a specific type using
malloc() to dynamically allocate an array of objects of a specific type.
|
|
Macro: Allocate an object of a specific type using
malloc() to dynamically allocate an object of a specific type.
|
|
Macro: Allocate and initialise temporary memory allocation structure.
|
|
Frees unused temporary memory.
|
|
Initialise temporary memory allocation structure.
|
|
Frees all temporary memory.
|
|
Returns the total temporary memory currently allocated.
|
|
Temporary memory free routine.
|
|
Frees a list of temporaray blocks terminated by
NULL . gan_ms_free() is called for each block, preserving the order of the arguments in the calls. |
|
Temporary memory allocation routine, faster than malloc().
|
|
Macro: Dynamically allocate n items of a specific type with "stack" memory.
|
|
Macro: Dynamically allocate one item of a specific type with "stack" memory.
|
|
Macro: Reallocate an array of objects using
realloc() to dynamically reallocate an array of objects of a specific type. If ptr is passed as NULL then it is equivalent to calling gan_malloc_array().
|