memmgr.h 759 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * @file memmgr.h
  3. * Furi: memory managment API and glue
  4. */
  5. #pragma once
  6. #include <stddef.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include "check.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. // define for test case "link against furi memmgr"
  14. #define FURI_MEMMGR_GUARD 1
  15. /** Get free heap size
  16. *
  17. * @return free heap size in bytes
  18. */
  19. size_t memmgr_get_free_heap(void);
  20. /** Get heap watermark
  21. *
  22. * @return minimum heap in bytes
  23. */
  24. size_t memmgr_get_minimum_free_heap(void);
  25. /** Allocate memory from heap
  26. *
  27. * @note performs memset with 0, will crash system if not enough memory
  28. *
  29. * @param[in] size bytes to allocate
  30. *
  31. * @return pointer to allocated memory
  32. */
  33. void* furi_alloc(size_t size);
  34. #ifdef __cplusplus
  35. }
  36. #endif