allocator¶
Utilities to use custom allocators instead of stdlib’s implementation.
This is: malloc()
, free()
, calloc()
and realloc()
.
-
struct alloc_stats_t¶
[source] Information about an allocation.
-
const allocator_t *allocator¶
[source] Allocator used to request this memory.
-
lifetime_t lifetime¶
[source] Allocation’s duration.
-
const allocator_t *allocator¶
-
struct allocator_t¶
[source] Information about a custom allocator.
-
const realloc_fn realloc¶
[source] Pointer to its
realloc
implementation.
-
const realloc_fn realloc¶
Caution
These wrappers add some extra logic as well as calling allocator->function(args)
.
Use them instead of manually executing the functions.
-
void *malloc_with(const allocator_t *allocator, size_t total_size)¶
[source] Run
malloc
’s implementation of the given allocator.
-
void free_with(const allocator_t *allocator, void *ptr)¶
[source] Run
free
’s implementation of the given allocator.
-
void *calloc_with(const allocator_t *allocator, size_t nmemb, size_t size)¶
[source] Run
calloc
’s implementation of the given allocator.
-
void *realloc_with(const allocator_t *allocator, void *ptr, size_t size)¶
[source] Run
realloc
’s implementation of the given allocator.
-
const allocator_t *const *get_known_allocators(size_t *n)¶
[source] Get a pointer to every allocator implementation.
n
will be set to the number of allocators.
-
const alloc_stats_t *get_allocations(size_t *n)¶
[source] Get a pointer to every tracked allocation implementation.
n
will be set to the number of allocation.
-
extern const allocator_t *const ch_core_allocator¶
[source] ChibiOS’ core allocator.
-
const allocator_t new_ch_pool_allocator(int *pool, const char *name)¶
[source] Create a new ChibiOS’ pool allocator.
-
const allocator_t new_ch_heap_allocator(int *heap, const char *name)¶
[source] Create a new ChibiOS’ heap allocator.