Is your feature request related to a problem?
The libcoap implementation currently ported by this component relies on HAVE_MALLOC in the port configuration and routes all memory allocations through the default malloc(). This force all memory allocations in this library to be routed to internal memory on ESP32 devices unless CONFIG_SPIRAM_USE_MALLOC is globally enabled for the entire project.
Describe the solution you'd like.
Introduce a KConfig option to enable SPIRAM allocations for the library that disables HAVE_MALLOC in the POSIX configuration and provides proper heap_caps_malloc() overrides for coap_malloc_type(), coap_realloc_type(), and coap_free_type().
Describe alternatives you've considered.
Simply enabling CONFIG_SPIRAM_USE_MALLOC for all projects that use SPIRAM is not a best practice and applications should have the ability to tune the memory allocation strategy for the library components they include.
Additional context.
No response
Is your feature request related to a problem?
The
libcoapimplementation currently ported by this component relies onHAVE_MALLOCin the port configuration and routes all memory allocations through the defaultmalloc(). This force all memory allocations in this library to be routed to internal memory on ESP32 devices unlessCONFIG_SPIRAM_USE_MALLOCis globally enabled for the entire project.Describe the solution you'd like.
Introduce a KConfig option to enable SPIRAM allocations for the library that disables
HAVE_MALLOCin the POSIX configuration and provides properheap_caps_malloc()overrides forcoap_malloc_type(),coap_realloc_type(), andcoap_free_type().Describe alternatives you've considered.
Simply enabling
CONFIG_SPIRAM_USE_MALLOCfor all projects that use SPIRAM is not a best practice and applications should have the ability to tune the memory allocation strategy for the library components they include.Additional context.
No response