Skip to content

Instantly share code, notes, and snippets.

@arifbalik
Created February 26, 2025 11:57
Show Gist options
  • Save arifbalik/232ee46b6fa3b1ab3ddcbf1b5864b154 to your computer and use it in GitHub Desktop.
Save arifbalik/232ee46b6fa3b1ab3ddcbf1b5864b154 to your computer and use it in GitHub Desktop.
Zephyr Heap Info
extern struct k_heap _system_heap;
struct sys_memory_stats stats;
void rtos_hal_print_heap_info(void)
{
sys_heap_runtime_stats_get(&_system_heap.heap, &stats);
printk("\n");
printk("INFO: Allocated Heap = %zu\n", stats.allocated_bytes);
printk("INFO: Free Heap = %zu\n", stats.free_bytes);
printk("INFO: Max Allocated Heap = %zu\n", stats.max_allocated_bytes);
printk("\n");
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment