malloc/free is there a way to see if all match?
I am exposed to this project where malloc is liberally spread all over the place and wonder if memory get freed up in all cases. I would hate to see that, after a month of usage the thing blew up. A very subtle error in this respect would never show up during development where the program is reloaded many times a day, whereas at a customer where a reset may be a yearly event a small error in this respect would show up eventually.
Erik
You can replace all calls to malloc/free with your own implementation that keeps track of things. You can find inspiration in some of the memory managers made available via FreeRTOS. The advantage here is that you can take measures of allocation fails - you are in total control.
For embedded use, it is often advantageous to create heaps of different-sized blocks, where the program may be able to allocate max M blocks of size 128 byte, max N blocks of size 512 byte, ...
This is basically the strategy used by RTX.
With pool of fixed-size objects, there can't be any fragmentation. The disadvantage is that a pool can have lots of free space, while a pool of different-sized objects can have all objects already allocated.