Heap clarification

Dear all, When creating a task we pass as parameters heap size for the task, my question is : if this task is allocating dynamic data with pvPortMalloc (lets say heap4 implementation) does the allocated pointer data are limited with the task heap size or by global heap size (defined in freertosconfig.h) ? in fact the heap stack size passed during task create is not so clear for me. rgds David

Heap clarification

The parameter you pass when you create a task is the STACK size (in words) for the task, which if dynamically allocated comes from the heap. It has nothing to do with how much heap space that task can use for other purposes (except that the total available heap space has been reduced by that allocation).

Heap clarification

Thanks RIchard for clarification, but I guess the PvPortMalloc is concerning by ConfigtotalHeapsize parameters ?

Heap clarification

configTOTALHEAPSIZE (in FreeRTOSConfig.h) determines how much heap space to create TOTAL, for all usages (and tasks), unless you are using heap3 (which uses the implementations built in malloc/free and the heap size is set in the way specified by the implementation), or heap5 (where you need to call vPortDefineHeapRegions and pass it the blocks of memory to be used for the heap. Calls to pvPortMalloc will take from that heap for all usages, and all tasks share this same heap.