Hi guys,
I’m sure that is not a valid concern, but I prefer to have an answer by those who have more experience than me.
I’m using FreeRTOS 9.0 and heap_4.c for heap memory management.
In order to simplify my question, let us imagine that we use a 8-bit processor (so, a word is a byte)
Now, I need to create a task after creating and deleting another tasks (so, my heap memory can be a little bit fragmented):
ReturnState = xTaskCreate( MyTask,
( char * ) “MyTask”,
4 * configMINIMAL_STACK_SIZE,
( void * ) NULL,
1,
NULL);
Of course, the configTOTAL_HEAP_SIZE is large enough for another task.
MyTask code is the following:
void MyTask( void *pvParameters ) { uint8_t MyArray[3*configMINIMAL_STACK_SIZE]; memset((void *)&MyArray[0],0xA5,sizeof(MyArray)); printf("The last number of my array is: %d",MyArray[3*configMINIMAL_STACK_SIZE-1]); for(;;;) __asm('NOP'); }
In MyTask I’ve created an array with size larger than configMINIMAL_STACK_SIZE. If heap memory is fragmented, FreeRTOS ensure me that the MyArray is allocated to a single memory block ?
Thanks for your reply.
Sincerely,
FlavioB