If you never give freeRTOS the time to run system tasks, you will see that the heap memory available will slowly go down over time until the program crashes.
Simply adding a tiny delay allows the task to yield.
The dramatic impact of this tiny change is easy to check if you create a 2nd task that does
printf("free heap: %d\n",esp_get_free_heap_size());
Every 5s or so.
If you never give freeRTOS the time to run system tasks, you will see that the heap memory available will slowly go down over time until the program crashes. Simply adding a tiny delay allows the task to yield. The dramatic impact of this tiny change is easy to check if you create a 2nd task that does printf("free heap: %d\n",esp_get_free_heap_size()); Every 5s or so.