6#ifndef ZEPHYR_INCLUDE_SYS_SYS_HEAP_H_
7#define ZEPHYR_INCLUDE_SYS_SYS_HEAP_H_
63struct z_heap_stress_result {
76#ifdef CONFIG_SYS_HEAP_RUNTIME_STATS
85int sys_heap_runtime_stats_get(
struct sys_heap *heap,
97int sys_heap_runtime_stats_reset_max(
struct sys_heap *heap);
179 size_t align,
size_t bytes);
181#define sys_heap_realloc(heap, ptr, bytes) \
182 sys_heap_aligned_realloc(heap, ptr, 0, bytes)
213#ifdef CONFIG_SYS_HEAP_VALIDATE
253 void (*free_fn)(
void *arg,
void *p),
254 void *arg,
size_t total_bytes,
256 void *scratch_mem,
size_t scratch_bytes,
258 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.
static bool sys_heap_validate(struct sys_heap *heap)
Validate heap integrity.
Definition sys_heap.h:216
void * sys_heap_aligned_alloc(struct sys_heap *heap, size_t align, size_t bytes)
Allocate aligned memory from a sys_heap.
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
size_t init_bytes
Definition sys_heap.h:60
struct z_heap * heap
Definition sys_heap.h:58
void * init_mem
Definition sys_heap.h:59
Definition mem_stats.h:24