Hi,
Is it possible to analyze a heap size?
I know that there is a feature of FreeRTOS heap size monitoring.
Standard C library malloc or even sprintf uses heap memory that is not managed region of memory by RTOS.
I think such standard C library is not recommended to use when RTOS is used due to non thread safe. But, some customers still want to use such C standard library and analyze the heap size.
Hiroshi,
Solved! Go to Solution.
Mixing heaps (C library and FreeRTOS) is not a good idea and could lead to some very hardtop-debug issues. However, if you insist, then see
Heap allocation/checking in Redlib
and the final reply here
Hi Hiroshi,
MCUxpresso IDE has tools for FreeRTOS HEAP usage monitor. This is the easiest way.
FreeRTOS itself hasn't such a library. There is some discuss on internet about how to monitor. People have to write monitor code by themselves.
Regards,
Jing
HI, jingpan
Thanks, ok. I will look up the internet.
And, don't you have any information about monitoring the heap size that is not managed by RTOS?
Hiroshi,
Mixing heaps (C library and FreeRTOS) is not a good idea and could lead to some very hardtop-debug issues. However, if you insist, then see
Heap allocation/checking in Redlib
and the final reply here
How do you avoid mixing heaps in case you want to use FreeRTOS and C library functions when some of them use malloc() and free()?
I see at least to possible approaches:
OR
The latter is Dave Nadler's approach.
Maybe you suggest a different third approach?
Thanks!
Dan
Ups, have to reply to myself.
I read that Dave Nadler already tried the first approach and stopped after he figured that FreeRTOS heap implementations would not support realloc()directly. One would have to implement this function.
So I guess the easiest way is to redirect pvPortMalloc() and vPortFree() using D. Nadler's code. However, with this approach, one forfeits the use of Heap View in MCUXpresso IDE.