Heap Debugging

Problems concerning the heap might occur due to the allocated heap memory size being too small, or the choice of heap implementation doesn’t suit the application.

The function xPortGetFreeHeapSize() returns the total amount of heap space that remains unallocated when called. If this is very small, increasing the heap size might be considered.

Choosing a heap implementation that is not suiting the application can also cause trouble. As mentioned in the “Configuring Memory” section, there are five different heap implementations. Some of them do not free allocated memory, while others have problems with allocating memory of random size. The heap requirements for the specific application must be considered. See https://www.freertos.org/a00111.html for more information on each heap implementation.