TLS_FreeRTOS_Connect Heap leak

Question,
I use heap_4 and have a heap leak between the function call TLS_FreeRTOS_Connect and TLS_FreeRTOS_Disconnect. 736 Bytes of heap are missing after TLS_FreeRTOS_Disconnect. Are there any ideas to debug this? Nucleo F429 140kB of Heap and after a few https connections the heap is empty.
Edit: using Mbed-TLS
Thanks a lot!

Thank you for your question, we will get back to you soon.

Hello Felix1,
Can you please provide more context on how you are using the TLS functions and your implementation?

Using Mbed-TLS like in this example: /http/http-demo-with-tls-mutual-authentication.html
with Mutexes. Spawning for every connection a task and delete the task after TLS_FreeRTOS_Disconnect.
The Task itself works fine (uncomment TLS Stuff). The config is like: /FreeRTOS/FreeRTOS/blob/202112.00/FreeRTOS-Plus/Demo/coreHTTP_Windows_Simulator/HTTP_Mutual_Auth/mbedtls_config.h

Can’t Post direct links. First is freertos, second git

Hello Felix,
The demo and config file does give some context in, however can you please share how to recreate your problem with smallest piece of code. Also are you strictly following the demo or have you made some changes to the demo for your use.

Best Regards,
AR

Fixed it.
I use configSUPPORT_DYNAMIC_ALLOCATION so the function mbedtls_platform_mutex_free(mbedtls_threading_mutex_t *pMutex) in freertos_port.c doesn’t frees anything, because this function expects Static memory.
Thanks for your efforts.

1 Like