public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Dave Nadler <drn@nadler.com>
To: Rob Meades <Rob.Meades@u-blox.com>,
	"newlib@sourceware.org" <newlib@sourceware.org>
Subject: Re: _reclaim_reent() and printf()
Date: Sat, 14 Nov 2020 18:12:45 -0500	[thread overview]
Message-ID: <ec0d6a75-47a1-fe1c-b346-a6d70971c142@nadler.com> (raw)
In-Reply-To: <sig.1587aa77dc.CWXP265MB00392C5720A2A595DD7D0C55BEE50@CWXP265MB0039.GBRP265.PROD.OUTLOOK.COM>

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


      reply	other threads:[~2020-11-14 23:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-14 22:25 Rob Meades
2020-11-14 23:12 ` Dave Nadler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ec0d6a75-47a1-fe1c-b346-a6d70971c142@nadler.com \
    --to=drn@nadler.com \
    --cc=Rob.Meades@u-blox.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).