X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_50,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Mark Geisert Subject: Re: [bash or DLL] Memory leak in childs Date: Wed, 20 Jul 2011 01:40:56 +0000 (UTC) Lines: 76 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Heiko Elger writes: > I just used another small testcase doing the same. [...] > $ cat test2.sh > #!/bin/sh > trap "echo TRAP; exit -1" SIGHUP SIGINT SIGQUIT SIGILL SIGTRAP SIGABRT > SIGEMT SIGFPE SIGKILL SIGBUS SIGSEGV SIGSYS SIGPIPE SIGALRM SIGTERM > SIGURG SIGSTOP SIGTSTP > SIGCONT SIGCHLD SIGTTIN SIGTTOU SIGIO SIGXCPU SIGXFSZ SIGVTALRM SIGPROF > SIGWINCH SIGPWR SIGUSR1 SIGUSR2 SIGRTMAX > > while ./exiter-vs2003.exe ; do > echo -n $? > done > echo RC=$? > ****** snip snip snip ****** > > exiter-vs2003.c.c ist compiled with MS Visual Studio 2003 > ****** snip snip snip ****** > $ cat exiter-vs2003.c > #include > > int main(int argc, char** argv[]) (I won't point out the error in the above line.) > { > printf("."); > return 0; > } Thanks very much for the specific info. I happened to have VS 2003 around so I was able to build the toy program. The bad news is that I did reproduce what you're seeing on my quad-core 2.6Ghz system. Over a 15 minute span peak memory use went from 227MB to 392MB. After that point the system seemed to go kind of haywire: window title bars were no longer being refreshed but rather overwritten, no further output in the window running the 10 copies of test2.sh, Task Manager having trouble refreshing its displays. I rebooted the system because I no longer trusted its operation. The good news is that I was then able to reproduce the issue without Cygwin. I coded up a "test2.bat" as follows: @echo off :again exiter-vs2003 echo %errorlevel% if %errorlevel%==0 goto again ..and a "driver.bat" to launch 10 copies of test2.bat as follows: start /b test2.bat start /b test2.bat start /b test2.bat start /b test2.bat start /b test2.bat start /b test2.bat start /b test2.bat start /b test2.bat start /b test2.bat start /b test2.bat I did all that in a Command Prompt window so that Cygwin was not involved in any way. Then I started up driver.bat. After 15 minutes, peak memory usage had gone from 227MB to 334MB and the system went haywire in the same fashion as before. I rebooted again. The moral of this story seems to be: Running an executable many thousands of times with multiple copies running at once eventually uses up some critical Windows internal resource(s) and causes the system to malfunction. It doesn't matter whether the executable is run from a Cygwin environment or a native Windows environment. HTH, ..mark -- 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