mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 20:21:04 +00:00
feat(heap): Add walker to the heap component
Introduce new APIs in essp_heap_caps.h: - heap_caps_walk() - heap_caps_walk_all() Those functions are triggering a callback for all blocks (allocated or free) of memory present in heaps meeting the set of capabilities passed as parameter (or all heaps for heap_caps_walk_all() function) test_walker.c added to test the new functionality in test_apps/heap_test/
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -207,6 +207,26 @@ size_t multi_heap_reset_minimum_free_bytes(multi_heap_handle_t heap);
|
||||
*/
|
||||
void multi_heap_restore_minimum_free_bytes(multi_heap_handle_t heap, const size_t new_minimum_free_bytes_value);
|
||||
|
||||
/**
|
||||
* @brief Callback called when walking the given heap blocks of memory
|
||||
*
|
||||
* @param block_ptr Pointer to the block data
|
||||
* @param block_size The size of the block
|
||||
* @param block_used Block status. 0 if free, else, false
|
||||
* @param user_data Opaque pointer to user defined data
|
||||
*/
|
||||
typedef void (*multi_heap_walker_cb_t)(void *block_ptr, size_t block_size, int block_used, void *user_data);
|
||||
|
||||
/**
|
||||
* @brief Call the tlsf_walk_pool function of the heap given as parameter with
|
||||
* the walker function passed as parameter
|
||||
*
|
||||
* @param heap The heap to traverse
|
||||
* @param walker_func The walker to trigger on each block of the heap
|
||||
* @param user_data Opaque pointer to user defined data
|
||||
*/
|
||||
void multi_heap_walk(multi_heap_handle_t heap, multi_heap_walker_cb_t walker_func, void *user_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user