This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

malloc/free is there a way ....

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

Parents Reply Children
  • 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.