Closed begriffs closed 1 year ago
Hi @begriffs
Currently there is no such logic in our +POSIX library that switches between only static or only dynamic memory use. I'm not sure there's a POSIX mechanism to specify that either. You must support dynamic allocation with this library as pvPortMalloc
is used both directly in pthread_create
and within it's usage of xTaskCreate
.
You can entirely avoid dynamic allocation by directly using kernel functions. xTaskCreateStatic enables you to statically allocate thread's kernel resources. It needs to be enabled with configSUPPORT_STATIC_ALLOCATION == 1
.
Sadly the original comment is incorrect. FreeRTOS+Posix only supports dynamic memory.
Hi, this comment says that FreeRTOS+Posix uses only static memory allocation. However, I didn't succeed in using the project with the following settings in FreeRTOSConfig.h:
The failure happened because
pthread_create
usespvPortMalloc
here: https://github.com/FreeRTOS/Lab-Project-FreeRTOS-POSIX/blob/3b33c3467d1345d332752aa9c155da9683183c49/FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_pthread.c#L295Is there an alternative function to
pthread_create
I should use in projects without dynamic allocation support?