Where does xQueueCreate get its memory from?
Where does xQueueCreate get its memory from?
It's a rather stupid sounding question and seems straight forward... You'd think a queue would be allocate on the heap. But, it seems not because I've found that creating tasks and queues seems to run me out of memory but when I trim it down just a bit (so that the code doesn't instantly ABORT() on start up) I find that the heap still has like 180K free! So, where are task stacks and queues allocated? And, how can I figure out how much of that RAM I've still got left?
Re: Where does xQueueCreate get its memory from?
If you call xQueueCreate() or xTaskCreate() or xTaskCreatePinnedToCore(), the memory for the queue contents or the task stack is allocated from heap.
If you have external SPI RAM enabled, the tasks have to be allocated from internal memory but the queues can be allocated anywhere.
There are also "static versions" of these functions, xQueueCreateStatic() and xTaskCreateStatic, etc. which allow you to provide the buffers, so they can be statically allocated. But it doesn't like that's in use here.
There is some heap memory which is not available during the early boot process (it's reserved for stacks used by startup code). However by the time app_main() is running, this memory will be available on the heap.
Can you give some specifics about what code caused you to run out of memory, and exactly what errors were seen?
If you have external SPI RAM enabled, the tasks have to be allocated from internal memory but the queues can be allocated anywhere.
There are also "static versions" of these functions, xQueueCreateStatic() and xTaskCreateStatic, etc. which allow you to provide the buffers, so they can be statically allocated. But it doesn't like that's in use here.
There is some heap memory which is not available during the early boot process (it's reserved for stacks used by startup code). However by the time app_main() is running, this memory will be available on the heap.
Can you give some specifics about what code caused you to run out of memory, and exactly what errors were seen?
Re: Where does xQueueCreate get its memory from?
http://esp-idf.readthedocs.io/en/latest ... skHandle_t
I cant find this function in docs but i am using it:
I cant find this function in docs but i am using it:
Code: Select all
ESP_LOGW(TAG, "RAM left %d", esp_get_free_heap_size());
Who is online
Users browsing this forum: Bing [Bot] and 88 guests