1 #include <rtthread.h> 2 #include <stdlib.h> 3 get_free_heap_size(void)4 size_t get_free_heap_size(void) 5 { 6 rt_uint32_t total, used, max; 7 8 rt_memory_info(&total, &used, &max); 9 10 return total - used; 11 } 12