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: [bash or DLL] Memory leak in childs


Classic.... this is windows for you. And they want me to get a phone based in Windows? Or a Ford Fusion, based on Windows? LOL

On 7/19/2011 8:40 PM, Mark Geisert wrote:
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



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


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