Heap_5: Choosing memory space for allocation


I found older posts (7003), and would like to know if there’s a workaround/a way to select which region to allocate in, I want for certain use-cases to have the ability to decide in which heap region to allocate the block and I didn’t find a solution for this issue.

Thank you!

Are you talking about extending the heap API to pass an extra flag and decide based on that which region to allocate from? If yes, you can use this implementation from Espressif as a reference - esp-idf/components/heap at master · espressif/esp-idf · GitHub

To add to this - this functionality isn’t supported natively for heap 5. The guidance posted in post 7003 and the example posted by Guarav are your best bet.