xPortGetFreeHeapSize() - Unexplained low values

saden123
Posts: 12
Joined: Tue Jul 24, 2018 12:18 am

xPortGetFreeHeapSize() - Unexplained low values

Postby saden123 » Thu Nov 11, 2021 8:27 pm

(IDF: 3.2.2)
I have a task running in a tight loop calling xPortGetFreeHeapSize() to monitor heap levels for my application.
Most of my heap is statically allocated at start-up; cJSON and libesphttpd are the main dynamic users of heap memory, and they are working quite hard: My UI is in HTTP/JS, and shows a lot of live data, ~3k of TCPIP, 3 times per second)
The heap sits at 20k to 40k free during execution, but on very rare occasions xPortGetFreeHeapSize() will return a very low figure of 30 to 60 bytes. The application can run for days with no crashes or allocation failures, so I'm confused as to how these low figures are triggered, but my app works fine.
Does Anyone know what might cause this behaviour such as heap management or background IDF operations? or is my applications heap usage on the very limit, and I've been lucky?

Hmmmm..
Si.

Who is online

Users browsing this forum: Bryght-Richard and 188 guests