I'm monitoring my heap usage with esp_get_free_heap_size() during the program's lifetime. I have noticed a strange behavior (at least for my level of comprehension of the FreeRTOS).
Let's assume these simple lines of code :
Code: Select all
if ( 1 > 2)
{
xTaskCreate(&myTask);
}
Obviously the condition will never be true and the task will never start. I can monitor my heap size and get value X with this code compiled.
Now, if I simply comment the task creation :
Code: Select all
if ( 1 > 2)
{
//xTaskCreate(&myTask);
}
and I monitor again my heap size after compilation, this value will be > X.
I cannot understand how is this possible and how FreeRTOS is allocating the heap usage at compile time. Any answers will greatly help me, Thank you.
Tibi