I need to monitor how much heap was ever left available, as a minimum, after I have run my CI test suite. This is the true minimum heap ever remaining, so taking account of calls to malloc() as well as to Zephyr's memory management APIs, i.e. the true underlying heap low water mark.
I could do this on NRF52 as I had the implementation of _sbrk() that FreeRTOS called into (the Dave Nadler one).
What is the equivalent in the nRFConnect/Zephyr world on NRF53?
I'm not sure about this. I'll ask internally about it. You could also try to ask in any of the resources listed here.
OK, have asked on the Zephyr Slack but I expect they'll bounce me back here for a "platform implementation" issue.
No, no response from Zephyr to my questions either on their Slack channel or via their mailing list. Very odd: like being asked to buy a car without a fuel gauge. Can't be normal can it?
FYI, just been pointed at this: https://github.com/zephyrproject-rtos/zephyr/issues/23076. Seems that heap monitoring is not yet implemented in Zephyr. But even if it was it doesn't answer the whole question because I guess Zephyr would likely sit on top of malloc() rather than below. How do I monitor the true heap usage on NRF53 using nRFConnect/.Zephyr?
I got some answers internally. It does not seem like there is something built-in for "heap painting". However, for stack there are, check out the config CONFIG_INIT_STACKS.
In order to achieve this, you would need to initialize the area on init, and clear/reset every allocated/free'd blob. Do you know how to go about this? If not I can look into it and try to make it work.