Heap usage monitoring


Rob Meades
 

I have a question about heap usage monitoring.  Apologies if this is the wrong place to ask, please feel free to point me elsewhere if that is the case.

I'm using Zephyr on a Nordic NRF53 chip and 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.  What is the equivalent in the nRFConnect/Zephyr world?  I've asked Nordic (https://devzone.nordicsemi.com/f/nordic-q-a/67495/finding-the-heap-low-water-mark-when-using-nrfconnect-zephyr) but they didn't know the answer immediately and suggested I might ask here instead.

I note that there are heap stress and heap validation functions in sys/sys_heap.c but nothing in there about heap usage. You must have something of this nature to test for memory leaks: can you point me in the right direction please?

Rob


Becker Markus
 

-----Original Message-----
From: users@lists.zephyrproject.org <users@lists.zephyrproject.org> On Behalf Of Rob Meades via lists.zephyrproject.org
Sent: Montag, 26. Oktober 2020 11:01
To: Zephyr-users@lists.zephyrproject.org
Subject: [Zephyr-users] Heap usage monitoring

I have a question about heap usage monitoring. Apologies if this is the wrong place to ask, please feel free to point me elsewhere if that is the case.

I'm using Zephyr on a Nordic NRF53 chip and 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. What is the equivalent in the nRFConnect/Zephyr world? I've asked Nordic (https://devzone.nordicsemi.com/f/nordic-q-a/67495/finding-the-heap-low-water-mark-when-using-nrfconnect-zephyr) but they didn't know the answer immediately and suggested I might ask here instead.

I note that there are heap stress and heap validation functions in sys/sys_heap.c but nothing in there about heap usage. You must have something of this nature to test for memory leaks: can you point me in the right direction please?

Rob






________________________________
The contents of this e-mail and any attachments are confidential to the intended recipient. They may not be disclosed to or used by or copied in any way by anyone other than the intended recipient. If this e-mail is received in error, please immediately notify the sender and delete the e-mail and attached documents. Please note that neither the sender nor the sender's company accept any responsibility for viruses and it is your responsibility to scan or otherwise check this e-mail and any attachments.