diff --git a/components/heap/heap_task_info.c b/components/heap/heap_task_info.c index 880bf358fd..8844e4fea8 100644 --- a/components/heap/heap_task_info.c +++ b/components/heap/heap_task_info.c @@ -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, ®istered_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; diff --git a/examples/system/heap_task_tracking/advanced/README.md b/examples/system/heap_task_tracking/advanced/README.md index ca8fe744d4..60184556e5 100644 --- a/examples/system/heap_task_tracking/advanced/README.md +++ b/examples/system/heap_task_tracking/advanced/README.md @@ -1,7 +1,7 @@ | Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | | ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- | -------- | -# Heap Task Tracking Basic Example +# Heap Task Tracking Advanced Example ## Overview @@ -10,7 +10,7 @@ The main then goes into a loop calling functions retrieving statistics for the " For each tasks, the following information is retrieved and printed: - the task name - the task status (running or deleted) - - the overall peak memory usage of the task + - the overall peak memory usage of the task - the overall current memory usage of the task For each heap used by a given task, the following information is printed: - the heap name