From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20536 invoked from network); 19 Oct 2006 10:38:36 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.7 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 19 Oct 2006 10:38:36 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 72544 invoked from network); 19 Oct 2006 10:38:30 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 Oct 2006 10:38:30 -0000 Received: (qmail 3802 invoked by alias); 19 Oct 2006 10:38:26 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22887 Received: (qmail 3793 invoked from network); 19 Oct 2006 10:38:25 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 19 Oct 2006 10:38:25 -0000 Received: (qmail 72190 invoked from network); 19 Oct 2006 10:38:25 -0000 Received: from cluster-d.mailcontrol.com (217.69.20.190) by a.mx.sunsite.dk with SMTP; 19 Oct 2006 10:38:23 -0000 Received: from exchange03.csr.com (uuk202166.uk.customer.alter.net [62.189.241.194] (may be forged)) by rly08d.srv.mailcontrol.com (MailControl) with ESMTP id k9JAc0uA026282 for ; Thu, 19 Oct 2006 11:38:01 +0100 Received: from cameurexb01.EUROPE.ROOT.PRI ([10.100.137.61]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 19 Oct 2006 11:33:47 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Thu, 19 Oct 2006 11:33:47 +0100 Date: Thu, 19 Oct 2006 11:33:47 +0100 From: Peter Stephenson To: zsh Subject: Re: 24948: max size of an array ? Message-Id: <20061019113347.22f235a8.pws@csr.com> Organization: Cambridge Silicon Radio X-Mailer: Sylpheed version 2.2.9 (GTK+ 2.8.20; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 19 Oct 2006 10:33:47.0607 (UTC) FILETIME=[0F56D670:01C6F36A] X-Scanned-By: MailControl A-07-06-60 (www.mailcontrol.com) on 10.68.0.118 Didn't send this to the list, again... Marc Chantreux wrote: > I noticed that the max size of an array is 24948. Is it right ? Is there > a way to work around ? The number in the code currently says 262144, but yes, there's a limit. I'm not at all sure it's right. It was added as an entirely arbitrary limit to prevent people crashing the shell by assigning to large array elements, with no correlation to the actual amount of memory available. The correct fix would be for the shell to fail gracefully when it couldn't allocate memory, but that's quite tricky to handle in all circumstances. Second-guessing user behaviour with a fixed limit is somewhat fraught. It would be fairly straightforward to make the limit configurable via a parameter such as ZSH_MAX_ARRLEN. This would have to be a special parameter for efficiency (we test this quite a lot deep in the parameter code). I suppose then we'd have people complaining they set ZSH_MAX_ARRLEN to several zillion and then the shell crashed when they tried to allocate an array. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php