Merge branch 'feature/heap_caps_get_size_free' into 'master'
add heap_caps_get_allocated_size See merge request espressif/esp-idf!6375
This commit is contained in:
commit
04dbe663be
2 changed files with 20 additions and 0 deletions
|
@ -462,3 +462,10 @@ void heap_caps_dump_all(void)
|
||||||
{
|
{
|
||||||
heap_caps_dump(MALLOC_CAP_INVALID);
|
heap_caps_dump(MALLOC_CAP_INVALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t heap_caps_get_allocated_size( void *ptr )
|
||||||
|
{
|
||||||
|
heap_t *heap = find_containing_heap(ptr);
|
||||||
|
size_t size = multi_heap_get_allocated_size(heap->heap, ptr);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
|
@ -324,6 +324,19 @@ void heap_caps_dump(uint32_t caps);
|
||||||
*/
|
*/
|
||||||
void heap_caps_dump_all(void);
|
void heap_caps_dump_all(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return the size that a particular pointer was allocated with.
|
||||||
|
*
|
||||||
|
* @param ptr Pointer to currently allocated heap memory. Must be a pointer value previously
|
||||||
|
* returned by heap_caps_malloc,malloc,calloc, etc. and not yet freed.
|
||||||
|
*
|
||||||
|
* @note The app will crash with an assertion failure if the pointer is not valid.
|
||||||
|
*
|
||||||
|
* @return Size of the memory allocated at this block.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
size_t heap_caps_get_allocated_size( void *ptr );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue