AnsweredAssumed Answered

What's the best way to redefine malloc Et Al. functions for FreeRTOS ?

Question asked by Ibrahim KAMAL on Jul 30, 2020
Latest reply on Jul 30, 2020 by Ibrahim KAMAL



We have C++ projects, using Newlib, and noticed that internal functions of newlib (like printf() ) call malloc (and other functions of the same family like malloc_r, etc.).


This is problematic for many reasons that are obvious and I'm not going to list here.


We would like to redefine all memory allocation function to use FreeRTOS memory allocation function like pvPortMalloc.


Is there an exhaustive list of functions that need to be re-implemented and example implemnetation for FreeRTOS?


Or should i just do it myself and reeimplement all these functions ? (although I'm not sure i fully understand all of them, like malloc_r() for example)

I feel like it's a known problem, and i wouldn't want to reinvent the wheel.


Any advice would be greatly apreciated.