fix(heap): Do not consider newly registered heap in minimum free size calcualtion

After startup is done and app_main is reached, all calls to
heap_caps_add_region_with_caps (adding a new heap to the list of registered
heaps) will not affect the minimum free heap size value.

For heaps created before startup, this won't apply and their size will
end up being taken into account in the calculation of the minimum.
This commit is contained in:
Guillaume Souchere
2026-05-29 07:56:48 +02:00
parent 465c4ffc64
commit aaae14008a
5 changed files with 68 additions and 7 deletions
+3
View File
@@ -230,6 +230,9 @@ size_t heap_caps_get_free_size( uint32_t caps );
* tracked per-region. Individual regions' heaps may have reached their "low watermarks" at different points in time. However,
* this result still gives a "worst case" indication for all-time minimum free heap.
*
* @note Heaps added at runtime using heap_caps_add_region_with_caps() (i.e., from app_main onwards) are not taken into
* account in the minimum free size calculation.
*
* @param caps Bitwise OR of MALLOC_CAP_* flags indicating the type
* of memory
*