X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.3 required=5.0	tests=AWL,BAYES_00,KHOP_THREADED,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
From: Adam Dinwoodie <Adam.Dinwoodie@metaswitch.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: RE: Shell script loop runs out of memory
Date: Fri, 1 Jun 2012 09:20:21 +0000
Deferred-Delivery: Fri, 1 Jun 2012 09:20:00 +0000
Message-ID: <CE9C056E12502146A72FD81290379E9A4360C73F@ENFIRHMBX1.datcon.co.uk>
References: <loom.20120531T193933-322@post.gmane.org> <CANs8wdBYOBGsmp2iFSSOOd5FZ4qb3i3a-E2EM8LBbPKz=su5Pg@mail.gmail.com> <786EBDA1AC46254B813E200779E7AD36023A42C2@srv1163ex1.flightsafety.com> <loom.20120531T211830-607@post.gmane.org> <0105D5C1E0353146B1B222348B0411A20A770C827D@NIHMLBX02.nih.gov>
In-Reply-To: <0105D5C1E0353146B1B222348B0411A20A770C827D@NIHMLBX02.nih.gov>
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q519Mi6x009627

Buchbinder, Barry wrote:
> You might try changing
>     [[ condition ]]
> to
>     [ condition ]
> Perhaps single brackets use memory differently than double brackets.

They do: [[ condition ]] is interpreted by the shell; [ condition ] forks to
call /usr/bin/[.exe. If forking is the problem, that'll make it worse.

> If that doesn't work, try changing
>     #!/bin/sh
> (which calls bash) to
>     #!/bin/dash
> You will have to have retained the double to single bracket change,
> because dash does not have double brackets.  Perhaps dash is more
> efficient with memory than bash.

There's a whole bunch of other alternatives: ksh, zsh, ash, etc. If the
problem is forking, however, none of those are going to improve things.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


