Anyone hit a task limit?

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Anyone hit a task limit?

Postby fly135 » Mon Mar 12, 2018 10:46 pm

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

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Anyone hit a task limit?

Postby fly135 » Mon Mar 12, 2018 11:12 pm

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

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Anyone hit a task limit?

Postby WiFive » Mon Mar 12, 2018 11:35 pm

External RAM cannot be used as task stack memory
https://esp-idf.readthedocs.io/en/lates ... l-ram.html

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Anyone hit a task limit?

Postby fly135 » Tue Mar 13, 2018 12:17 am

Well that explains it. Now I just need to figure out how to make sure I reserve memory for task creation.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Anyone hit a task limit?

Postby WiFive » Tue Mar 13, 2018 12:23 am


User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Anyone hit a task limit?

Postby fly135 » Tue Mar 13, 2018 12:57 am


User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Anyone hit a task limit?

Postby fly135 » Tue Mar 13, 2018 1:04 am

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.

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Anyone hit a task limit?

Postby fly135 » Tue Mar 13, 2018 5:40 pm

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)

Who is online

Users browsing this forum: No registered users and 72 guests