PICO_MALLOC_TRACK_PEAK, peak allocation tracking for malloc#1755
PICO_MALLOC_TRACK_PEAK, peak allocation tracking for malloc#1755cellularmitosis wants to merge 1 commit into
Conversation
|
Looks interesting |
|
Some additional info about
|
It should be pointed out that the author of that forum post (that would be me) was not sure if mallinfo is always guaranteed to work that way. Said author is still not sure, it all depends on how malloc() and mallinfo() work. If an app does a lot of malloc()ing and free()ing, it is not hard to imagine that non-contiguous allocated and freed portions of the heap could result in such a way that the mallinfo numbers don't add up so neatly. It's worth looking into, because malloc_peak_bytes would be valuable. The truth is in the newlib source code. It would also help to test an app that causes some heap fragmentation with malloc() and free(), and then check what mallinfo says. |
This PR implements a peak allocated bytes tracking option for malloc.
To enable:
Usage: determining the peak allocated bytes during a block of code / call-stack:
which will print: