Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
heap_listener.h File Reference
#include <stdint.h>
#include <zephyr/toolchain.h>
#include <zephyr/sys/slist.h>

Go to the source code of this file.

Data Structures

struct  heap_listener
 

Macros

#define HEAP_ID_FROM_POINTER(heap_pointer)   ((uintptr_t)heap_pointer)
 Construct heap identifier from heap pointer.
 
#define HEAP_ID_LIBC   ((uintptr_t)0)
 Libc heap identifier.
 
#define HEAP_LISTENER_ALLOC_DEFINE(name, _heap_id, _alloc_cb)
 Define heap event listener node for allocation event.
 
#define HEAP_LISTENER_FREE_DEFINE(name, _heap_id, _free_cb)
 Define heap event listener node for free event.
 
#define HEAP_LISTENER_RESIZE_DEFINE(name, _heap_id, _resize_cb)
 Define heap event listener node for resize event.
 

Typedefs

typedef void(* heap_listener_resize_cb_t) (uintptr_t heap_id, void *old_heap_end, void *new_heap_end)
 Callback used when heap is resized.
 
typedef void(* heap_listener_alloc_cb_t) (uintptr_t heap_id, void *mem, size_t bytes)
 Callback used when there is heap allocation.
 
typedef void(* heap_listener_free_cb_t) (uintptr_t heap_id, void *mem, size_t bytes)
 Callback used when memory is freed from heap.
 

Enumerations

enum  heap_event_types {
  HEAP_EVT_UNKNOWN = 0 , HEAP_RESIZE , HEAP_ALLOC , HEAP_FREE ,
  HEAP_REALLOC , HEAP_MAX_EVENTS
}
 

Functions

void heap_listener_register (struct heap_listener *listener)
 Register heap event listener.
 
void heap_listener_unregister (struct heap_listener *listener)
 Unregister heap event listener.
 
void heap_listener_notify_alloc (uintptr_t heap_id, void *mem, size_t bytes)
 Notify listeners of heap allocation event.
 
void heap_listener_notify_free (uintptr_t heap_id, void *mem, size_t bytes)
 Notify listeners of heap free event.
 
void heap_listener_notify_resize (uintptr_t heap_id, void *old_heap_end, void *new_heap_end)
 Notify listeners of heap resize event.