From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8597 invoked by alias); 8 Nov 2012 10:02:35 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17385 Received: (qmail 23351 invoked from network); 8 Nov 2012 10:02:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at samsung.com does not designate permitted sender hosts) Date: Thu, 08 Nov 2012 10:02:26 +0000 From: Peter Stephenson To: zsh-user Subject: Re: argv subscript range uses too many memory Message-id: <20121108100226.575b0788@pwslap01u.europe.root.pri> In-reply-to: <20121108084001.GA7594@localhost.localdomain> References: <20121108084001.GA7594@localhost.localdomain> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-TM-AS-MML: No On Thu, 08 Nov 2012 16:40:01 +0800 Han Pingtian wrote: > This script on my laptop uses so much memory so that being killed by > oom-killer: > > arr=(~/**/*) > set -- "${(@)arr}" > > while ((ARGC)) > do > print -- "${argv[1,3]}" > shift 3 > done > > But if change the subscript range to single array elements, it works > just fine. So I suspect there is something wrong with the subscript > range. > > Any thoughts? I think you're right --- I think that was what was causing the memory usage for zargs to go haywire for me last week. I couldn't see anything obviously wrong when I looked, but it may be a pathology with the way memory is allocated and freed. pws