heap.c 329 B

12345678910111213141516171819
  1. #include <rtthread.h>
  2. #include <stdlib.h>
  3. size_t get_free_heap_size(void)
  4. {
  5. rt_uint32_t total, used, max;
  6. rt_memory_info(&total, &used, &max);
  7. return total - used;
  8. }
  9. #if (RTTHREAD_VERSION >= RT_VERSION_CHECK(4, 1, 0))
  10. extern int cmd_free(int argc, char **argv);
  11. void list_mem(void)
  12. {
  13. cmd_free(0, 0);
  14. }
  15. #endif