delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/07/19/21:41:50

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 <mark AT maxrnd DOT com>
Subject: Re: [bash or DLL] Memory leak in childs
Date: Wed, 20 Jul 2011 01:40:56 +0000 (UTC)
Lines: 76
Message-ID: <loom.20110720T032257-444@post.gmane.org>
References: <loom DOT 20110718T073757-2 AT post DOT gmane DOT org> <loom DOT 20110718T083650-815 AT post DOT gmane DOT org> <loom DOT 20110719T064243-907 AT post DOT gmane DOT org> <loom DOT 20110719T092021-102 AT post DOT gmane DOT org> <loom DOT 20110719T101702-272 AT post DOT gmane DOT org>
Mime-Version: 1.0
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: <cygwin.cygwin.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

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 <stdio.h>
> 
> 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

- Raw text -


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