Merge branch 'fix/task_tracing_crashing_6.0' into 'release/v6.0'

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

See merge request espressif/esp-idf!43447
This commit is contained in:
Jiang Jiang Jian
2026-01-08 20:48:20 +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;
@@ -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