Open escherstair opened 5 months ago
I'm not familiar with FreeRTOS, but in general:
If you don't use cJSON_InitHooks
, cJSON will per default call the standard functions malloc
, realloc
and free
.
So I guess the call to cJSON_InitHooks
being mandatory or optional depends on if a call to these default functions is available and acceptable for your system or not.
This depends a lot on your context. But as the standard functions are not thread safe and you are probably in a multithreaded environment, I would prefer the memory management provided by FreeRTOS.
FreeRTOS uses its own memory management that provides custom implementations for the memory allocators.
The allocators are:
I wonder if when cJSON is used in a project that runs on the top of FreeRTOS, customizing the allocators with
cJSON_InitHooks
is mandatory or optional. Does this depend on which FreeRTOS implementation is used (i.e.,heap_x.c
)?