Well, I guess the whole question lies in the title.
I have been batteling between using the FreeRTOS provided heap management and the compiler provided memory management.
The FreeRTOS scheme is winning at the moment because I can easely make isso that the memory size is defined at run time and not comile time (since the board can be loaded in the factory with any size RAM)...
However, I do need a realloc and I would like it to be more optimized than a basic malloc/copy/free scheme (ie: free extra ram if shrink and grow in place (if possible)).
Has anyone ever implemented such function in heap4.c?
If you want realloc, I would go to heap_3.c and use that method. The other option which is available with some implementations, is to see if your library has hooks in it to make malloc/free/realloc thread safe (I know some versiion of newlib have this).
Except that this assumes that the linker does have a free/malloc/realloc, which is not the case for me (well, more specially, I do not want to use their versions because I can not modify them and make them able to deal with my ram which is of unknown size at build time. Size is detected at run time).
Most people use a crude free and re-allocation. I'm not aware of
anything more sophisticated.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.