6#ifndef ZEPHYR_INCLUDE_SYS_SYS_HEAP_H_
7#define ZEPHYR_INCLUDE_SYS_SYS_HEAP_H_
62struct z_heap_stress_result {
75#ifdef CONFIG_SYS_HEAP_RUNTIME_STATS
84int sys_heap_runtime_stats_get(
struct sys_heap *heap,
96int sys_heap_runtime_stats_reset_max(
struct sys_heap *heap);
178 size_t align,
size_t bytes);
180#define sys_heap_realloc(heap, ptr, bytes) \
181 sys_heap_aligned_realloc(heap, ptr, 0, bytes)
244 void (*free_fn)(
void *arg,
void *p),
245 void *arg,
size_t total_bytes,
247 void *scratch_mem,
size_t scratch_bytes,
249 struct z_heap_stress_result *result);
void * sys_heap_aligned_realloc(struct sys_heap *heap, void *ptr, size_t align, size_t bytes)
Expand the size of an existing allocation.
void sys_heap_init(struct sys_heap *heap, void *mem, size_t bytes)
Initialize sys_heap.
void * sys_heap_alloc(struct sys_heap *heap, size_t bytes)
Allocate memory from a sys_heap.
void * sys_heap_aligned_alloc(struct sys_heap *heap, size_t align, size_t bytes)
Allocate aligned memory from a sys_heap.
bool sys_heap_validate(struct sys_heap *heap)
Validate heap integrity.
void sys_heap_free(struct sys_heap *heap, void *mem)
Free memory into a sys_heap.
void sys_heap_stress(void *(*alloc_fn)(void *arg, size_t bytes), void(*free_fn)(void *arg, void *p), void *arg, size_t total_bytes, uint32_t op_count, void *scratch_mem, size_t scratch_bytes, int target_percent, struct z_heap_stress_result *result)
sys_heap stress test rig
void sys_heap_print_info(struct sys_heap *heap, bool dump_chunks)
Print heap internal structure information to the console.
size_t sys_heap_usable_size(struct sys_heap *heap, void *mem)
Return allocated memory size.
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT64_TYPE__ uint64_t
Definition: stdint.h:91
Definition: sys_heap.h:56
size_t init_bytes
Definition: sys_heap.h:59
struct z_heap * heap
Definition: sys_heap.h:57
void * init_mem
Definition: sys_heap.h:58
Definition: mem_stats.h:24