LiVES
3.2.0
|
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
struct | rpmalloc_global_statistics_t |
struct | rpmalloc_thread_statistics_t |
struct | rpmalloc_config_t |
Macros | |
#define | RPMALLOC_EXPORT |
#define | RPMALLOC_ALLOCATOR |
#define | RPMALLOC_ATTRIB_MALLOC |
#define | RPMALLOC_ATTRIB_ALLOC_SIZE(size) |
#define | RPMALLOC_ATTRIB_ALLOC_SIZE2(count, size) |
#define | RPMALLOC_CDECL |
#define | RPMALLOC_CONFIGURABLE 0 |
Define RPMALLOC_CONFIGURABLE to enable configuring sizes. Will introduce. More... | |
#define | RPMALLOC_FIRST_CLASS_HEAPS 0 |
Define RPMALLOC_FIRST_CLASS_HEAPS to enable heap based API (rpmalloc_heap_* functions). More... | |
#define | RPMALLOC_NO_PRESERVE 1 |
Flag to rpaligned_realloc to not preserve content in reallocation. More... | |
#define | RPMALLOC_GROW_OR_FAIL 2 |
Flag to rpaligned_realloc to fail and return null pointer if grow cannot be done in-place,. More... | |
Functions | |
RPMALLOC_EXPORT int | rpmalloc_initialize (void) |
Initialize allocator with default configuration. More... | |
RPMALLOC_EXPORT int | rpmalloc_initialize_config (const rpmalloc_config_t *config) |
Initialize allocator with given configuration. More... | |
RPMALLOC_EXPORT const rpmalloc_config_t * | rpmalloc_config (void) |
Get allocator configuration. More... | |
RPMALLOC_EXPORT void | rpmalloc_finalize (void) |
Finalize allocator. More... | |
RPMALLOC_EXPORT void | rpmalloc_thread_initialize (void) |
Initialize allocator for calling thread. More... | |
RPMALLOC_EXPORT void | rpmalloc_thread_finalize (void) |
Finalize allocator for calling thread. More... | |
RPMALLOC_EXPORT void | rpmalloc_thread_collect (void) |
Perform deferred deallocations pending for the calling thread heap. More... | |
RPMALLOC_EXPORT int | rpmalloc_is_thread_initialized (void) |
Query if allocator is initialized for calling thread. More... | |
RPMALLOC_EXPORT void | rpmalloc_thread_statistics (rpmalloc_thread_statistics_t *stats) |
Get per-thread statistics. More... | |
RPMALLOC_EXPORT void | rpmalloc_global_statistics (rpmalloc_global_statistics_t *stats) |
Get global statistics. More... | |
RPMALLOC_EXPORT void | rpmalloc_dump_statistics (void *file) |
Dump all statistics in human readable format to file (should be a FILE*) More... | |
RPMALLOC_EXPORT RPMALLOC_ALLOCATOR void * | rpmalloc (size_t size) RPMALLOC_ATTRIB_MALLOC RPMALLOC_ATTRIB_ALLOC_SIZE(1) |
Allocate a memory block of at least the given size. More... | |
RPMALLOC_EXPORT void | rpfree (void *ptr) |
Free the given memory block. More... | |
RPMALLOC_EXPORT RPMALLOC_ALLOCATOR void * | rpcalloc (size_t num, size_t size) RPMALLOC_ATTRIB_MALLOC RPMALLOC_ATTRIB_ALLOC_SIZE2(1 |
Allocate a memory block of at least the given size and zero initialize it. More... | |
RPMALLOC_EXPORT RPMALLOC_ALLOCATOR void RPMALLOC_EXPORT RPMALLOC_ALLOCATOR void * | rprealloc (void *ptr, size_t size) RPMALLOC_ATTRIB_MALLOC RPMALLOC_ATTRIB_ALLOC_SIZE(2) |
Reallocate the given block to at least the given size. More... | |
RPMALLOC_EXPORT RPMALLOC_ALLOCATOR void * | rpaligned_realloc (void *ptr, size_t alignment, size_t size, size_t oldsize, unsigned int flags) RPMALLOC_ATTRIB_MALLOC RPMALLOC_ATTRIB_ALLOC_SIZE(3) |
Reallocate the given block to at least the given size and alignment,. More... | |
RPMALLOC_EXPORT RPMALLOC_ALLOCATOR void * | rpaligned_alloc (size_t alignment, size_t size) RPMALLOC_ATTRIB_MALLOC RPMALLOC_ATTRIB_ALLOC_SIZE(2) |
Allocate a memory block of at least the given size and alignment. More... | |
RPMALLOC_EXPORT RPMALLOC_ALLOCATOR void * | rpaligned_calloc (size_t alignment, size_t num, size_t size) RPMALLOC_ATTRIB_MALLOC RPMALLOC_ATTRIB_ALLOC_SIZE2(2 |
Allocate a memory block of at least the given size and alignment, and zero initialize it. More... | |
RPMALLOC_EXPORT RPMALLOC_ALLOCATOR void RPMALLOC_EXPORT RPMALLOC_ALLOCATOR void * | rpmemalign (size_t alignment, size_t size) RPMALLOC_ATTRIB_MALLOC RPMALLOC_ATTRIB_ALLOC_SIZE(2) |
Allocate a memory block of at least the given size and alignment. More... | |
RPMALLOC_EXPORT int | rpposix_memalign (void **memptr, size_t alignment, size_t size) |
Allocate a memory block of at least the given size and alignment. More... | |
RPMALLOC_EXPORT size_t | rpmalloc_usable_size (void *ptr) |
Query the usable size of the given memory block (from given pointer to the end of block) More... | |
#define RPMALLOC_ALLOCATOR |
Definition at line 42 of file rpmalloc.h.
#define RPMALLOC_ATTRIB_ALLOC_SIZE | ( | size | ) |
Definition at line 44 of file rpmalloc.h.
#define RPMALLOC_ATTRIB_ALLOC_SIZE2 | ( | count, | |
size | |||
) |
Definition at line 45 of file rpmalloc.h.
#define RPMALLOC_ATTRIB_MALLOC |
Definition at line 43 of file rpmalloc.h.
#define RPMALLOC_CDECL |
Definition at line 46 of file rpmalloc.h.
#define RPMALLOC_CONFIGURABLE 0 |
Define RPMALLOC_CONFIGURABLE to enable configuring sizes. Will introduce.
Definition at line 52 of file rpmalloc.h.
#define RPMALLOC_EXPORT |
Definition at line 41 of file rpmalloc.h.
#define RPMALLOC_FIRST_CLASS_HEAPS 0 |
Define RPMALLOC_FIRST_CLASS_HEAPS to enable heap based API (rpmalloc_heap_* functions).
Definition at line 58 of file rpmalloc.h.
#define RPMALLOC_GROW_OR_FAIL 2 |
Flag to rpaligned_realloc to fail and return null pointer if grow cannot be done in-place,.
Definition at line 66 of file rpmalloc.h.
#define RPMALLOC_NO_PRESERVE 1 |
Flag to rpaligned_realloc to not preserve content in reallocation.
Definition at line 62 of file rpmalloc.h.
RPMALLOC_EXPORT RPMALLOC_ALLOCATOR void* rpaligned_alloc | ( | size_t | alignment, |
size_t | size | ||
) |
Allocate a memory block of at least the given size and alignment.
Definition at line 2669 of file rpmalloc.c.
Referenced by rpaligned_calloc(), rpmemalign(), and rpposix_memalign().
RPMALLOC_EXPORT RPMALLOC_ALLOCATOR void* rpaligned_calloc | ( | size_t | alignment, |
size_t | num, | ||
size_t | size | ||
) |
Allocate a memory block of at least the given size and alignment, and zero initialize it.
RPMALLOC_EXPORT RPMALLOC_ALLOCATOR void* rpaligned_realloc | ( | void * | ptr, |
size_t | alignment, | ||
size_t | size, | ||
size_t | oldsize, | ||
unsigned int | flags | ||
) |
Reallocate the given block to at least the given size and alignment,.
Definition at line 2656 of file rpmalloc.c.
RPMALLOC_EXPORT RPMALLOC_ALLOCATOR void* rpcalloc | ( | size_t | num, |
size_t | size | ||
) |
Allocate a memory block of at least the given size and zero initialize it.
|
inline |
Free the given memory block.
Definition at line 2612 of file rpmalloc.c.
Referenced by _ext_free(), and quick_free().
|
inline |
Allocate a memory block of at least the given size.
Definition at line 2600 of file rpmalloc.c.
Referenced by _ext_malloc().
RPMALLOC_EXPORT const rpmalloc_config_t* rpmalloc_config | ( | void | ) |
Get allocator configuration.
Definition at line 2593 of file rpmalloc.c.
RPMALLOC_EXPORT void rpmalloc_dump_statistics | ( | void * | file | ) |
Dump all statistics in human readable format to file (should be a FILE*)
Definition at line 2861 of file rpmalloc.c.
RPMALLOC_EXPORT void rpmalloc_finalize | ( | void | ) |
RPMALLOC_EXPORT void rpmalloc_global_statistics | ( | rpmalloc_global_statistics_t * | stats | ) |
Get global statistics.
Definition at line 2787 of file rpmalloc.c.
|
inline |
Initialize allocator with default configuration.
Initialize allocator with default configuration.
Definition at line 2318 of file rpmalloc.c.
Referenced by init_memfuncs().
RPMALLOC_EXPORT int rpmalloc_initialize_config | ( | const rpmalloc_config_t * | config | ) |
Initialize allocator with given configuration.
Definition at line 2327 of file rpmalloc.c.
RPMALLOC_EXPORT int rpmalloc_is_thread_initialized | ( | void | ) |
Query if allocator is initialized for calling thread.
Definition at line 2588 of file rpmalloc.c.
|
inline |
Perform deferred deallocations pending for the calling thread heap.
Definition at line 2720 of file rpmalloc.c.
RPMALLOC_EXPORT void rpmalloc_thread_finalize | ( | void | ) |
Finalize allocator for calling thread.
Finalize allocator for calling thread.
Definition at line 2577 of file rpmalloc.c.
Referenced by rpmalloc_finalize().
|
inline |
Initialize allocator for calling thread.
Initialize allocator for calling thread.
Definition at line 2562 of file rpmalloc.c.
Referenced by init_thread_memfuncs().
RPMALLOC_EXPORT void rpmalloc_thread_statistics | ( | rpmalloc_thread_statistics_t * | stats | ) |
Get per-thread statistics.
Definition at line 2724 of file rpmalloc.c.
|
inline |
Query the usable size of the given memory block (from given pointer to the end of block)
Definition at line 2715 of file rpmalloc.c.
|
inline |
Allocate a memory block of at least the given size and alignment.
Definition at line 2701 of file rpmalloc.c.
|
inline |
Allocate a memory block of at least the given size and alignment.
Definition at line 2706 of file rpmalloc.c.
|
inline |
Reallocate the given block to at least the given size.
Definition at line 2644 of file rpmalloc.c.
Referenced by _ext_realloc().