Open linuxforum5 opened 6 years ago
Thank you for the report. A first guess would be to look at the newlib integration into FreeRTOS. On a task being deleted it should call back into newlib to free up the newlib resources, and FreeRTOS calls _reclaim_reent() in libc/reent/reent.c
It might be that some of the I/O resource are not being freed. Some of these might be allocated in newlib/libc/stdio/findfp.c and there is a clean up function too.
I doubt there was anything in the commit you noticed that caused this apart from simply enabling the FreeRTOS integration with newlib which was essential. We will just have to work through it to get it freeing the resources properly.
Have you tried simply closing the stdin stdout and stderr FILEs before deleting the task to see if that solves this problem, or reduces the amount leaked?
Newlib also has an option to use global streams, and that might be another option to explore.
The vTaskDelete() is not freeing all unused memory. This is the sample code: heaptest.c.txt
The free heap is constant (43692) in version 0.0.1-134-gb83c262. screen.log.0.0.1-134-gb83c262.txt
Memory leaks in version 0.0.1-163-g546cc47 and in further versions. screen.log.0.0.1-260-g5f8b3d4.txt