delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/06/01/06:32:35

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 1 Jun 2012 12:31:48 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Shell script loop runs out of memory
Message-ID: <20120601103148.GB28506@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <loom DOT 20120531T193933-322 AT post DOT gmane DOT org>
MIME-Version: 1.0
In-Reply-To: <loom.20120531T193933-322@post.gmane.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On May 31 17:42, Jordan wrote:
> Hi folks,
> 
> I've written a shell script running under CygWin, the purpose of which is to 
> monitor a file for changes. If the MD5 hash fails to match the previous hash, it 
> will execute a command to process the file. I used a 1-second delay between 
> checks of the hash. This works great for several hours, but then gives an "out 
> of memory" error and actually brings Windows 7 to its knees.
> [...]
> Here is the script:
> ------------------------
> #!/bin/sh
> 
> FILE_TO_CHECK=/mypath/style.less
> 
> echo "Reading hash for $FILE_TO_CHECK with md5sum"
> MD5PRINT=`md5sum $FILE_TO_CHECK | cut -d " " -f1`
> 
> MD5PRINTNEW=$MD5PRINT
> 
> while [[ 1 = 1 ]]
> do
>         echo "Waiting for file to change..."
> 
>         while [[ "$MD5PRINT" = "$MD5PRINTNEW" ]]
>         do
>                 sleep 1
> 
>                 MD5PRINTNEW=`md5sum $FILE_TO_CHECK | cut -d " " -f1`
>         done
> 
>         echo "File was modified ... Running compiler..."
> 
>         /mypath/lessc $FILE_TO_CHECK /mypath/style.css -x
> 
>         echo "Reading hash for $FILE_TO_CHECK with md5sum"
>         MD5PRINT=`md5sum $FILE_TO_CHECK | cut -d " " -f1`
> 
>         MD5PRINTNEW=$MD5PRINT
> done
> ------------------------

I'm running your script with disabled "sleep 1" and disabled "/mypath/lessc"
for about half an hour now on W7.  Neither the system memory usage, nor
the process memory usage of the outmost shell, nor the handle count of
the outmost shell has changed during this time.

I'm running this under the last snapshot from http://cygwin.com/snapshots/ 
Either the bug is fixed there, or you're really under the influence of
some BLODA.  Did you even check for BLODA?  I didn't see a hint of that
in this thread.

Also, how often does the file change so that you have to run the
compiler?  Is the compiler a native or a Cygwin tool?  Does the memory
problem occur visibly in task manager?  All the time or only when the
compiler runs?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019