4 Replies Latest reply on Oct 24, 2017 1:41 PM by RaAl_264636

    How to test heap in case of using malloc(), etc.?

    RaAl_264636

      Hi,

       

      anyone knows a good and bullet-proof way to test heap consistency in case of using malloc(), etc.? I'm working on a queue implementation which is able to dynamically resize its data (not linked list approach). So, there's a queue struct, which has a pointer for the data field assigned by malloc(). The queue itself is also created dynamically.

       

      On a first thought, I'd reserve almost the complete heap by malloc(), fill it with a bit pattern of e.g. 0x55, then release it and create the queue(s). After that, I'd enqueue and dequeue data, with debug output of the queue state and data fields after each operation.

       

      Any other ideas?

       

      Regards,

       

      Ralf