Merge branch 'fix/task_tracing_crashing_5.5' into 'release/v5.5'

fix(heap): fix a bug where the biggest heap would be NULL on boot (backport v5.5)

See merge request espressif/esp-idf!43448
This commit is contained in:
Jiang Jiang Jian
2026-01-19 11:11:38 +08:00
2 changed files with 9 additions and 5 deletions
+7 -3
View File
@@ -57,12 +57,16 @@ FORCE_INLINE_ATTR heap_t* find_biggest_heap(void)
heap_t *heap = NULL;
heap_t *biggest_heap = NULL;
SLIST_FOREACH(heap, &registered_heaps, next) {
if (biggest_heap == NULL) {
/* In the case where we are currently looking for the biggest heap during startup,
* before the scheduler stated, all the memory regions marked as startup stacks will
* be NULL here. As such, they must be ignored. After boot up, this statement will
* never be true. */
if (heap->heap == NULL) {
/* Continue the loop */
} else if (biggest_heap == NULL) {
biggest_heap = heap;
} else if ((biggest_heap->end - biggest_heap->start) < (heap->end - heap->start)) {
biggest_heap = heap;
} else {
// nothing to do here
}
}
return biggest_heap;