From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3641 invoked from network); 10 May 2004 10:17:16 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.86) by ns1.primenet.com.au with SMTP; 10 May 2004 10:17:16 -0000 Received: (qmail 26979 invoked from network); 10 May 2004 10:16:59 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 10 May 2004 10:16:59 -0000 Received: (qmail 1115 invoked by alias); 10 May 2004 10:16:56 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19904 Received: (qmail 1106 invoked from network); 10 May 2004 10:16:56 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by sunsite.dk with SMTP; 10 May 2004 10:16:53 -0000 Received: (qmail 26841 invoked from network); 10 May 2004 10:16:52 -0000 Received: from lhuumrelay3.lnd.ops.eu.uu.net (62.189.58.19) by a.mx.sunsite.dk with SMTP; 10 May 2004 10:16:51 -0000 Received: from MAILSWEEPER01.csr.com (mailhost1.csr.com [62.189.183.235]) by lhuumrelay3.lnd.ops.eu.uu.net (8.11.0/8.11.0) with ESMTP id i4AAGOv02386 for ; Mon, 10 May 2004 10:16:24 GMT Received: from EXCHANGE02.csr.com (unverified [192.168.137.45]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id ; Mon, 10 May 2004 11:15:53 +0100 Received: from csr.com ([192.168.144.127]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 10 May 2004 11:17:55 +0100 To: zsh-workers@sunsite.dk cc: 245678-submitter@bugs.debian.org Subject: Re: Bug#245678: zsh: built-in rm -rf fills up the memory In-reply-to: "Bart Schaefer"'s message of "Sun, 09 May 2004 16:51:03 PDT." Date: Mon, 10 May 2004 11:16:23 +0100 Message-ID: <16158.1084184183@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 10 May 2004 10:17:55.0933 (UTC) FILETIME=[0F9FE8D0:01C43678] X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: * X-Spam-Status: No, hits=1.7 required=6.0 tests=BAYES_80 autolearn=no version=2.63 X-Spam-Hits: 1.7 Bart Schaefer wrote: > } [ h->used + (new - old) > HEAP_ARENA_SIZE ] > } 63432 + (63504 - 63432) > 16360 > > Aha! Note that h->used > HEAP_ARENA_SIZE all by itself! > > Comparing to HEAP_ARENA_SIZE is likely wrong, it should compare to the > maximum of either HEAP_ARENA_SIZE or the previously-mmapped page size. > I'm not entirely sure of that ... > > ... but that's why it begins re-zhalloc()-ing. In the non-MMAP case it > falls back on realloc() when a single allocation exceeds HEAP_ARENA_SIZE. > > So what probably needs to happen to prevent the out-of-memory condition > is that we need to explicitly munmap the old mmap'd block, somewhere. > > And then we need to emulate realloc() behavior somehow, in terms of > knowing whether to actually re-mmap-and-copy or whether the existing > mapped pages are large enough to contain the additional requested space. Looks like a rewrite of hrealloc is definitely in order... Does the bad behaviour go away if USE_MMAP is undefined? -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************