X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Torfinn Ottesen Subject: Re: "fork problem" debugging Date: Mon, 29 May 2006 15:40:54 +0000 (UTC) Lines: 79 Message-ID: References: <20060518023929 DOT 65449 DOT qmail AT web31310 DOT mail DOT mud DOT yahoo DOT com> <20060529095133 DOT GA18356 AT sellafield DOT lysator DOT liu DOT se> 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-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 Peter Ekberg lysator.liu.se> writes: > > On Sun, May 28, 2006 at 10:40:34PM +0000, Torfinn Ottesen wrote: > > > > > > I did this for three programs, prog1 (commercial, external), > > prog2 (inhouse, compiled on Cygwin) and native cygwin prog3: > > "echo". I claim that I saw increased increase memory usage > > for prog1 and prog2 - but not for the "echo" program. > > Did you really fork for echo, or did you use a shell builtin by mistake? > > /bin/echo is your friend... > > Cheers, > Peter > > Hm - $ which echo # give me: /usr/bin/echo whereas $ type echo # tells that it is a builtin ... thanks for the question, I am now sure that that it was the builtin by mistake. I repeated this right now with an interesting result: ------- for i in $(seq 1000) do /usr/bin/echo $i done Finding, reading off total commit charge in "Task Manager" - prior to execting loop three times: 357 400 kb - after 3 loops (3000 forks) : 370 550 kb After 3000 forks of /usr/bin/echo - about 13.2 MB memory increase. The value appears to be reasonable constant while writing this. ------------------- Exiting from my xterm, result : down to about 360 800 kb Exiting from Cygwin/X wmanager: down to about 342 600 kb --------------- Starting Cygwin/X with one xterm similar to situation prior to loop: up to 367 400 kb. About 10 MB more than before looping it three times, have lost about 10 MB somewhere. ----- Shutting down Cygwin/X, down to 343 100 kb, starting again, up to: 367 900 kb. (about the same as above) ------ Does 3000 forks, up to : 380 400 kb Shutting down Cygwin/X and up again, up to: 380 800 kb. ---- Well, it is repeatable here - memory is lost for each fork. The situation (lost memory) appears to be unaffected by shutting down and restarting Cygwin/X (doing this by X-ing). -------- Because of similarity with previous incidences I believe now that even this little "/usr/bin/echo" loop can bring down my PC if running long enough. ---- It would be interesting to see if someone else can reproduce this - I'll ask my collegue to try this one tomorrow. Regards Torfinn Ottesen (Cygwin on MS Win XP Pro Service Pack 1) PS: For what it is worth, I have a slightly modified Cygwin/X: C:\cygwin\usr\X11R6\bin\startxwin.bat %RUN% XWin -clipboard -silent-dup-error %RUN% xterm -bg FloralWhite -sb -rightbar -e /usr/bin/bash -l %RUN% wmaker -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/