Mbedtls_ssl_handshake gives 0x6180 error (failed to allocate memory) after 2 hours of operation

Hello all!

I am using STM32F4 MCU, version of MbedTLS is 2.11.0 (also tested with same effect on 2.16.3). My server code is exactly based on ssl_server.c example

Code is working good during 2 hours approximatelly. However, after 2 hours there is a error 0x6180 happening on mbedtls_ssl_handshake function.

Note that in all other places, where dynmic memory is allocated, it is freed correctly.

Can anyone advise can this problem be conected with configuration of mbedTLS and how to solve it? Thank you.

Hey,

Have you tried using the memory tracing API to verify that you definitely don’t have a memory leak? It’s also an easy way to check stack/heap usage during certain points within a function or program. Here’s a really good tutorial.

1 Like