AnsweredAssumed Answered

Malloc(a) Free(a) Malloc(b) should return same address?

Question asked by Vikky Patil on Feb 12, 2018
Latest reply on Feb 12, 2018 by Doug Kehn

Hi,

 

I tried doing malloc(x) and free(x) recursively till it returns null. x is always incrementing. Global interrupts are disabled before malloc and enable after free. There is no code in between malloc and free.

 

But every time I tried malloc and free sometimes I get the same address but sometimes different. Am trying this on STMF767ZI (M7). 

 

Logs

 

 

Aim: Determine the heap size at runtime.

Let me know if you have any simple way to determine heap size at runtime.

Outcomes