Page 1 of 1

Anyone hit a task limit?

Posted: Mon Mar 12, 2018 10:46 pm
by fly135
I'm working on an app that is returning -1 on xTaskCreate after I've previously created a few tasks. The heap indicates....

heap_caps_get_free_size(MALLOC_CAP_8BIT) = 1657700
heap_caps_get_free_size(MALLOC_CAP_32BIT) = 1703316
stack free of the calling (creating) task = 7980

When I call uxTaskGetNumberOfTasks, I get 14. There is nothing unusual about the call to xTaskCreate. If I move it up above the previous task create then it works and the next one that previously worked fails. I also commented out a call to another part of the app that creates a task and then it's fine. I'm wondering if there is a different memory that is used that wouldn't be reported in those two heap checks that would affect the ability to create a task.

I know this isn't specific to the ESP32. But I thought maybe there was something specific to the port to the ESP32 that might be a limitation.

John

Re: Anyone hit a task limit?

Posted: Mon Mar 12, 2018 11:12 pm
by fly135
More info....

I just made a loop and was able to create 65 tasks before getting an error return from xTaskCreate. I had 4M of heap left (wrover board) and 5K of stack space on the creating task (i.e. main task). So now the question is... What do I need to look at to see if I'm about out of resources to create a task?

John A

Re: Anyone hit a task limit?

Posted: Mon Mar 12, 2018 11:35 pm
by WiFive
External RAM cannot be used as task stack memory
https://esp-idf.readthedocs.io/en/lates ... l-ram.html

Re: Anyone hit a task limit?

Posted: Tue Mar 13, 2018 12:17 am
by fly135
Well that explains it. Now I just need to figure out how to make sure I reserve memory for task creation.

Re: Anyone hit a task limit?

Posted: Tue Mar 13, 2018 12:23 am
by WiFive

Re: Anyone hit a task limit?

Posted: Tue Mar 13, 2018 12:57 am
by fly135

Re: Anyone hit a task limit?

Posted: Tue Mar 13, 2018 1:04 am
by fly135
Well, you can't just double it from 32768 to 65536. You get this....

E (1171) cpu_start: Could not reserve internal/DMA pool!

But 48000 did work.

Re: Anyone hit a task limit?

Posted: Tue Mar 13, 2018 5:40 pm
by fly135
Is there a call that I can make to see how much internal ram is left available?

John A

edit: Found it.... heap_caps_get_free_size(MALLOC_CAP_INTERNAL)