Why sometimes the Heap Pointer will be pointed to 0x000000?
in my function, several heap pointers are defined like this

when I comment the 111 line. the whole code works well. But when I add this line, the pointer Test_feature, ZeroCenter_Parameters, C1K,C1B will all, or sometimes partly, point to 0x000000.
eventually in 2 debug with the same code, it may different.
so the Question is:
In general, What will let the Heap pointer point to 0x00000? before free.
for my observation, the heap size is enough on my project (HEAP SIZE=0x8000, the same as stack size). I'm using STM32F746NG-Discovery Board so the RAM Space(at least 240KB for algorithm) is also enough. So it may be the problem of the IDE or Compiler?
My environment:
KeilV523, STM32F746NG-Disco, Win10 Edu.
for more general situation. this code.
void heaptest()
{ int *a; a=(int*)malloc(1024*4); int i=1024; while(i--) { *a=i;//printf(''%d'',*a); a++; }free(a);
}0x08004468 BD10 POP {r4,pc}
176: a=(int*)malloc(1024*4);
177:
0x0800446A F44F5080 MOV r0,&sharp0x1000
174: {
175: int *a;
176: a=(int*)malloc(1024*4);
177:
0x0800446E B510 PUSH {r4,lr}
0x08004470 F000F8B6 BL.W malloc (0x080045E0)
178: int i=1024;
0x08004474 F44F6180 MOV r1,&sharp0x400
179: while(i--)
180: {
181:
0x08004478 E000 B 0x0800447C
182: *a=i;
183: //printf(''%d'',*a);
184: a++;
185: }
186:
0x0800447A C002 STM r0!,{r1}
0x0800447C 1E49 SUBS r1,r1,&sharp1
0x0800447E D2FC BCS 0x0800447A
187: free(a);
188: }
189: int main(void)
190: {
191: SCB_EnableICache();
192: SCB_EnableDCache();
0x08004480 E8BD4010 POP {r4,lr}
0x08004484 F7FFBF08 B.W free (0x08004298)
before the free operation, the pointer will be pointed to 0x00000. who did that?
#c #stm32f7 #heap #c/c+ #memory #keil #c++ #keil-ide #!stm32-!heap-!sdram-!malloc