Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
 4.1.99
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sys_heap.h File Reference
#include <stddef.h>
#include <stdbool.h>
#include <zephyr/types.h>
#include <zephyr/sys/mem_stats.h>
#include <zephyr/toolchain.h>

Go to the source code of this file.

Data Structures

struct  sys_heap
 

Functions

int sys_heap_runtime_stats_get (struct sys_heap *heap, struct sys_memory_stats *stats)
 Get the runtime statistics of a sys_heap.
 
int sys_heap_runtime_stats_reset_max (struct sys_heap *heap)
 Reset the maximum heap usage.
 
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.
 
void * sys_heap_noalign_alloc (struct sys_heap *heap, size_t align, size_t bytes)
 Allocate memory from a sys_heap.
 
void sys_heap_free (struct sys_heap *heap, void *mem)
 Free memory into a sys_heap.
 
void * sys_heap_realloc (struct sys_heap *heap, void *ptr, size_t bytes)
 Expand the size of an existing allocation.
 
void * sys_heap_aligned_realloc (struct sys_heap *heap, void *ptr, size_t align, size_t bytes)
 Expand the size of an existing allocation.
 
size_t sys_heap_usable_size (struct sys_heap *heap, void *mem)
 Return allocated memory size.
 
static bool sys_heap_validate (struct sys_heap *heap)
 Validate heap integrity.
 
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.
 
int sys_heap_array_save (struct sys_heap *heap)
 Save the heap pointer.
 
int sys_heap_array_get (struct sys_heap ***heap)
 Get the array of saved heap pointers.