Page 1 of 1

Stack overflow & heap monitoring

Posted: Fri Dec 22, 2017 12:45 pm
by dejan.ns
I know there is uxTaskGetStackHighWaterMark FreeRTOS function which can be used to get the minimum size of unused task stack, but I wonder if there is a ESP-IDF way of achieving this.

Also I would like to know what is the best method for watching the free heap size.

Re: Stack overflow & heap monitoring

Posted: Fri Dec 22, 2017 2:17 pm
by ESP_Sprite
Esp-idf uses FreeRTOS as its RTOS, so you can happily use uxTaskGetStackHighWaterMark. For the free heap size, you can use heap_caps_get_free_size(MALLOC_CAP_DEFAULT|MALLOC_CAP_8BIT). (Or use any other cap if you want to know stuff about the more specialized heap regions.)