unleashed-firmware/furi/core/memmgr.h
Sergei Gavrilov 5dddb075ac
TLSF memory allocator. Less free flash, moar free ram. (#3572)
* add tlsf as submodule
* libs: tlsf
* Furi: tlsf as allocator
* Furi: heap walker
* shmal fixshesh
* f18: tlsf
* PVS: ignore tlsf
* I like to moving
* merge upcoming changes
* memmgr: alloc aligned, realloc
* Furi: distinct name for auxiliary memory pool
* Furi: put idle and timer thread to mem2
* Furi: fix smal things in allocator
* Furi: remove aligned_free. Use free instead.
* aligned_malloc -> aligned_alloc
* aligned_alloc, parameters order
* aligned_alloc: check that alignment is correct
* unit test: malloc
* unit tests: realloc and test with memory fragmentation
* unit tests: aligned_alloc
* update api
* updater: properly read large update file

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2024-05-16 03:51:45 +03:00

62 lines
1 KiB
C

/**
* @file memmgr.h
* Furi: memory management API and glue
*/
#pragma once
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "check.h"
#ifdef __cplusplus
extern "C" {
#endif
// define for test case "link against furi memmgr"
#define FURI_MEMMGR_GUARD 1
/** Get free heap size
*
* @return free heap size in bytes
*/
size_t memmgr_get_free_heap(void);
/** Get total heap size
*
* @return total heap size in bytes
*/
size_t memmgr_get_total_heap(void);
/** Get heap watermark
*
* @return minimum heap in bytes
*/
size_t memmgr_get_minimum_free_heap(void);
/**
* @brief Allocate memory from the auxiliary memory pool. That memory can't be freed.
*
* @param size
* @return void*
*/
void* memmgr_aux_pool_alloc(size_t size);
/**
* @brief Get the auxiliary pool free memory size
*
* @return size_t
*/
size_t memmgr_aux_pool_get_free(void);
/**
* @brief Get max free block size from the auxiliary memory pool
*
* @return size_t
*/
size_t memmgr_pool_get_max_block(void);
#ifdef __cplusplus
}
#endif