Page 1 of 1

How to get free continuous stack size using esp-idf

Posted: Thu Sep 01, 2022 9:03 am
by mmmunir966
Hi,

I am looking for esp-idf function that can provide the availabke stack size just like it provides heap size using

Code: Select all

heap_caps_get_free_size()
I could find the way of determining the stack size of a freeRTOS task using

Code: Select all

xPortGetFreeHeapSize()
, however I want to know the total stack size available at any given point in any task?

Re: How to get free continuous stack size using esp-idf

Posted: Thu Sep 01, 2022 9:29 am
by ESP_Sprite
You probably want uxTaskGetStackHighWaterMark.

Re: How to get free continuous stack size using esp-idf

Posted: Fri Sep 02, 2022 7:14 am
by mmmunir966

Code: Select all

uxTaskGetStackHighWaterMark
This function provides free stack of the current task or the task of which the handler is passed, but I want to know the total available stack from all the tasks?

Re: How to get free continuous stack size using esp-idf

Posted: Fri Sep 02, 2022 12:09 pm
by ESP_Sprite
Can I ask why you would want that number? Given that stacks are dynamically allocated from the heap on task creation and the total amount of unused stack doesn't really have any meaning, I'm puzzled what information you'd be able to derive from that number.