From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cyan.elm.relay.mailchannels.net (cyan.elm.relay.mailchannels.net [23.83.212.47]) by sourceware.org (Postfix) with ESMTPS id ACE7E385780F for ; Sat, 14 Nov 2020 23:12:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org ACE7E385780F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nadler.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=drn@nadler.com X-Sender-Id: dreamhost|x-authsender|drn@nadler.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 9B10A120672; Sat, 14 Nov 2020 23:12:48 +0000 (UTC) Received: from pdx1-sub0-mail-a24.g.dreamhost.com (100-96-227-237.trex.outbound.svc.cluster.local [100.96.227.237]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id E1112121290; Sat, 14 Nov 2020 23:12:47 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|drn@nadler.com Received: from pdx1-sub0-mail-a24.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.10); Sat, 14 Nov 2020 23:12:48 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|drn@nadler.com X-MailChannels-Auth-Id: dreamhost X-Snatch-Wide-Eyed: 6697021004d2e3cb_1605395568364_606205253 X-MC-Loop-Signature: 1605395568364:3981882218 X-MC-Ingress-Time: 1605395568364 Received: from pdx1-sub0-mail-a24.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a24.g.dreamhost.com (Postfix) with ESMTP id A383A8A3E4; Sat, 14 Nov 2020 15:12:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=nadler.com; h=subject:to :references:from:message-id:date:mime-version:in-reply-to :content-type; s=nadler.com; bh=4SJzJJZQHtAkUSY4br4bkdBzqQk=; b= KcNCZF2ehZ1QOuB0VN+ye7DHADSlMTIfU3yY8riKIWHR9QwNDtDU090S7EIgWL5I E8cYDg3fyS0Rzg2dIm/cYKw8bnVpQqDiDMRAoEGxaY5OIk/wfaBzX6/1uhrnX8ZQ BV1xSIjKNBK+GS9Ecdn72SYy3ZW6Uw4W292A/qKe8FY= Received: from [192.168.1.10] (pool-72-74-171-157.bstnma.fios.verizon.net [72.74.171.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: drn@nadler.com) by pdx1-sub0-mail-a24.g.dreamhost.com (Postfix) with ESMTPSA id AD7CB8A3D3; Sat, 14 Nov 2020 15:12:46 -0800 (PST) Subject: Re: _reclaim_reent() and printf() To: Rob Meades , "newlib@sourceware.org" References: X-DH-BACKEND: pdx1-sub0-mail-a24 From: Dave Nadler Message-ID: Date: Sat, 14 Nov 2020 18:12:45 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Spam-Status: No, score=1.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, NICE_REPLY_A, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Nov 2020 23:12:51 -0000 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