Setting Heap Management Scheme
Posted: Mon May 03, 2021 5:04 pm
Hello everybody,
I am new here so please forgive me if the answer to my question is really obvious. For me it is not
In a thread I allocate memory either with or with . This works OK and when I check the size of the heap it shows exactly what I expect.
But when I try to deallocate the memory with or with the problems begin. I get CORRUPT HEAP: multi_heap.c:172 detected at 0x3ffb6ddc and the program reboots.
The free rtos documentation mentions that one of heap_1.c, heap_2.c, heap_3.c, heap_4.c and heap_5.c must be included in the code and that heap_1.c does not allow to free the memory. Therefore I assume that I am using heap_1.c, but I don't know where to find the reference to this in my project.
Could someone be so nice and point me to the location of this file reference in the build process. Or in case someone knows a different reason for free to fail please let me know.
Thanks
I am new here so please forgive me if the answer to my question is really obvious. For me it is not
In a thread I allocate memory either with
Code: Select all
ptr = (char *)pvPortMalloc((digitc+1)*sizeof(char));
Code: Select all
ptr = (char *)malloc(digitc*sizeof(char));
But when I try to deallocate the memory with
Code: Select all
vPortFree(ptr);
Code: Select all
free(ptr);
The free rtos documentation mentions that one of heap_1.c, heap_2.c, heap_3.c, heap_4.c and heap_5.c must be included in the code and that heap_1.c does not allow to free the memory. Therefore I assume that I am using heap_1.c, but I don't know where to find the reference to this in my project.
Could someone be so nice and point me to the location of this file reference in the build process. Or in case someone knows a different reason for free to fail please let me know.
Thanks