This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Shell script loop runs out of memory

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$"
  sleep 1

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:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]