_reclaim_reent() and printf()

Dave Nadler drn@nadler.com
Sat Nov 14 23:12:45 GMT 2020


Whoops. Looks like a FreeRTOS bug (wrong assumption about newlib code).
I will try to look at this in detail tomorrow.
Because I never delete tasks I never noticed!

Thanks for pointing this out,
Best Regards, Dave

PS: The comment you referenced is only if normal reclamation did not happen,
which it doesn't if the FreeRTOS bug I think I see is real...

PPS: Can I hit you up with some uBlox questions sometime? ;-)

On 11/14/2020 5:25 PM, Rob Meades via Newlib wrote:
> I'm using an STM32F4 processor with newlib nano and FreeRTOS.  Have it all running quite sweetly, re-entrantly using the Dave Nadler code.  However, I find that the first call to printf() in a new task allocates 1468 bytes of memory and that memory is NOT reclaimed by the call to _reclaim_reent() that FreeRTOS makes on task deletion.
>
> Has anyone seen a problem of this nature?  I note that at the end of _reclaim_reent() there's a comment:
>
> /* Malloc memory not reclaimed; no good way to return memory anyway. */
>
> Is this refering to memory malloc()ed by newlib, in which case why could it not be free'd()?  Or is my problem more likely to be something specific to ST's HAL (I haven't found anything yet, and would be surprised if a HAL malloc()ed memory)?


-- 
Dave Nadler, USA East Coast voice (978) 263-0097, drn@nadler.com, Skype
  Dave.Nadler1



More information about the Newlib mailing list