This is the mail archive of the
mailing list for the Cygwin project.
Re: Shell script loop runs out of memory
- From: AZ 9901 <az9901 at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Thu, 31 May 2012 20:16:22 +0200
- Subject: Re: Shell script loop runs out of memory
- References: <loom.20120531T193933firstname.lastname@example.org>
2012/5/31 Jordan :
> I am just wondering why the loops here are consuming increasing amounts of
> memory over time? ÂI'm assigning new MD5 values into existing variables over and
> over, not allocating new variables for each MD5 assignment. (Right??) Is 1
> second perhaps too short a delay... does the system need time to deallocate
> something between each iteration of the inner loop?
You are certainly under effect of BLODA.
You could have a look (there is a BLODA section in Cygwin online doc).
Then, when (bash) scripting under Cygwin, you must take care to avoid
forking as much as possible.
You could try to improve the "sleep 1" loop with the following one :
while md5sum $FILE_TO_CHECK | cut -d " " -f1 | grep -q "^$MD5PRINT$"
Note that MD5PRINTNEW is no more useful here.
With this loop we avoid the fork done by
MD5PRINTNEW=`md5sum $FILE_TO_CHECK | cut -d " " -f1`
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple