feat(heap): Update get allocated size function to take any pointer

This commit is contained in:
Guillaume Souchere
2024-10-30 09:43:30 +01:00
parent 5f050afdc1
commit 8a987d9288
11 changed files with 202 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -38,6 +38,20 @@ typedef bool (*multi_heap_walker_cb_t)(void *block_ptr, size_t block_size, int b
*/
void multi_heap_walk(multi_heap_handle_t heap, multi_heap_walker_cb_t walker_func, void *user_data);
/**
* @brief Function walking through a given heap and returning the pointer to the
* allocated block containing the pointer passed as parameter.
*
* @note The heap parameter must be valid and the pointer parameter must
* belong to a block of allocated memory. The app will crash with an
* assertion failure if at least one of the parameter is invalid.
*
* @param heap The heap to walk through
* @param ptr The pointer to find the allocated block of
* @return Pointer to the allocated block containing the pointer ptr
*/
void *multi_heap_find_containing_block_impl(multi_heap_handle_t heap, void *ptr);
#ifdef __cplusplus
}
#endif