8 #ifndef CMAGIC_MEMORY_H 9 #define CMAGIC_MEMORY_H 171 typedef void* (*cmagic_memory_malloc_fptr_t)(
size_t size);
176 typedef void* (*cmagic_memory_realloc_fptr_t)(
void* ptr,
size_t size);
197 malloc, realloc, free
size_t cmagic_memory_get_free_bytes(void)
Returns number of free bytes in the memory pool.
void cmagic_memory_init(void *static_memory_pool, size_t static_memory_pool_size)
Sets a memory range where all dynamic allocated objects will reside.
void(* cmagic_memory_free_fptr_t)(void *ptr)
A pointer to free like function.
Definition: memory.h:181
Set of allocation functions. Used in some CMagic structures to specify a desired memory pool...
Definition: memory.h:187
bool cmagic_memory_is_allocated(void *ptr)
Checks if the memory block was allocated before with cmagic_memory_malloc or cmagic_memory_realloc an...
cmagic_memory_free_result
Type of result returned from cmagic_memory_free_ext.
Definition: memory.h:84
void *(* cmagic_memory_malloc_fptr_t)(size_t size)
A pointer to malloc like function.
Definition: memory.h:171
enum cmagic_memory_free_result cmagic_memory_free_ext(void *ptr)
Extended version of cmagic_memory_free.
void * cmagic_memory_realloc(void *ptr, size_t size)
Reallocates memory block changing its original size.
size_t cmagic_memory_get_allocated_bytes(void)
Returns the sum of currently allocated bytes.
void *(* cmagic_memory_realloc_fptr_t)(void *ptr, size_t size)
A pointer to realloc like function.
Definition: memory.h:176
void cmagic_memory_free(void *ptr)
Deallocates a block of memory previously allocated by a call to cmagic_memory_malloc or cmagic_memory...
static const cmagic_memory_alloc_packet_t CMAGIC_MEMORY_ALLOC_PACKET_STD
Allocation from the standard library.
Definition: memory.h:196
static const cmagic_memory_alloc_packet_t CMAGIC_MEMORY_ALLOC_PACKET_CUSTOM_CMAGIC
Custom allocation from the CMagic library.
Definition: memory.h:203
void * cmagic_memory_malloc(size_t size)
Dynamically allocates a block of memory of requested size, returning a pointer to the beginning of th...
size_t cmagic_memory_get_allocations(void)
Returns number of allocations made by cmagic_memory_malloc.