This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Finding the heap low water mark when using nRFConnect/Zephyr

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?

Rob

Parents Reply
  • Agree that largest contiguous region is probably a better measure, also saw your colleague "bjda" post that code on the Github thread, thanks.

    The remaining question, then, is how Zephyr uses the heap.  We are, of course, going to be calling malloc()/free() as any C code would, does Zephyr wrap those functions somehow and do entirely it's own thing with the heap memory, or does it work in parallel with them and sit atop malloc()/free() itself?  If the former then your colleague's solution is good, if the latter it won't help because it's only half the story.

    Or do you suggest I take this conversation up with your colleague on the Github issue thread?

Children
Related