Another malloc/free defragging scheme

Code is at https://github.com/wware/stuff/tree/master/hack-malloc

I wrote this before seeing Antonio Badalace's solution. His code will probably run a little faster than mine, because I also maintained the size-ordered linked list in the original heap_2.c and that involves some bookkeeping. The benefit to that is that allocations will (might?) be more parsimonious. The disadvantage of my version is that there is a second pointer in each block's header struct. It looks like Antonio has followed FreeRTOS coding conventions more carefully than I have. I plan to address that after I do some more extensive functional testing.


Please sign in to leave a comment.