From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5436 invoked from network); 22 Feb 2022 15:55:41 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 22 Feb 2022 15:55:41 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 283839CE74; Wed, 23 Feb 2022 01:55:35 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 4B1A39CBCD; Wed, 23 Feb 2022 01:53:15 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=pass (1024-bit key; secure) header.d=drijf.net header.i=@drijf.net header.b="bn1tJ8vq"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 2B7019CB50; Wed, 23 Feb 2022 01:53:13 +1000 (AEST) Received: from clue.drijf.net (clue.drijf.net [94.142.244.34]) by minnie.tuhs.org (Postfix) with ESMTPS id 73F4E9CB50 for ; Wed, 23 Feb 2022 01:53:11 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=drijf.net; s=default; t=1645545188; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rSnAikemzVRVlKEzKATh0rTIlKzMUtF92UBotEwVuQc=; b=bn1tJ8vq+VxElPq0PtSkcadZ/5Q6HkA6IDrXBD566Rv82PM82kDloXFarwh2+FDbckR1p/ RSbhC1gEoTIgRzWPauCMl4AH0sUCouUY4sk25p1Am4WzLC6foq9qRqexQcD92fCepV4Dp3 MAQkJ5ZVJZqsA15ESrVrBS1hwDYQ4Xo= Received: from clue.drijf.net (clue.drijf.net [94.142.244.34]) by mx1.drijf.net (OpenSMTPD) with ESMTPSA id d18a9267 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Tue, 22 Feb 2022 16:53:08 +0100 (CET) Date: Tue, 22 Feb 2022 16:53:06 +0100 From: Otto Moerbeek To: The Eunuchs Hysterical Society Message-ID: References: <202202160754.21G7sbUa011318@freefriends.org> <1nKFRN-4IZ-00@marmaro.de> <8735kig8vb.fsf@vuxu.org> <4E3028A1-EC08-424A-B814-CC2AEEEAEC7B@iitbombay.org> <20220222103948.1B0482206F@orac.inputplus.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220222103948.1B0482206F@orac.inputplus.co.uk> Subject: Re: [TUHS] Lorinda Cherry X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" On Tue, Feb 22, 2022 at 10:39:48AM +0000, Ralph Corderoy wrote: > Hi Otto, > > > MacOS uses the GNU implementation which has a long standing issue with > > deep recursion. It even cannot handle the tail recursive calls used > > here and will run out of its stack. > > When learning dc and seeing it relied on tail calls, the first thing > I did was check it did tail-call elimination, and it did. That was > GNU dc. > > Trying just now, I see no growth in memory usage despite heavy CPU load > shown by TIME increasing. > > $ dc > !ps u `pidof dc` > USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND > ralph 11489 0.0 0.0 2332 1484 pts/1 S+ 10:33 0:00 dc > [lmx]smlmx > ^C > Interrupt! > !ps u `pidof dc` > USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND > ralph 11489 75.5 0.0 2332 1488 pts/1 S+ 10:33 0:46 dc > > The memory used remained at that level during the macro execution too, > watched from outside. > > Do you have more detail on what GNU dc can't handle? dc without > tail-call elimination is a bit crippled. > > -- > Cheers, Ralph. On MacOS: $ dc --version dc (GNU bc 1.06) 1.3 ... $ dc [lmx]smlmx Segmentation fault: 11 $ On debian bullseye: $ dc --version dc (GNU bc 1.07.1) 1.4.1 ... $ dc [lmx]smlmx ... all ok. So the basic tail recursion case seems to be fixed in recent versions. But note that [laxp]sa 1 lax still segfaults on both GNU dc versions while on OpenBSD, using the dc I wrote: dc: recursion too deep: Cannot allocate memory This is not a tail recursion case, but segfaulting is not nice at all. -Otto