X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Lewis Hyatt Subject: Re: Huge memory leak, probably related to making new processes Date: Wed, 3 Oct 2007 04:20:18 +0000 (UTC) Lines: 44 Message-ID: References: <13006193 DOT post AT talk DOT nabble DOT com> <13010714 DOT post AT talk DOT nabble DOT com> 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 > Anyway, can I ask you to do this yourself - just do the last test: > > COUNTER=1 > while [ $COUNTER -lt 123456 ]; do (echo $COUNTER); let COUNTER=$COUNTER+1; > done > > and wait a little (couple of minutes). If necessary, repeat it until your > memory drops to 10-20 MB range and your HDD should start whining. Then close > cygwin and wait 10 minutes. The memory is still "occupied". I don't know > when Windows would free it, but I did not get that behavior with any other > program (e.g. try to open & close Firefox or such - it will show a peak in > both directions regarding memory and will do that almost immediately). > > Thanks for the note. I ran it for about 15 minutes, no problem. In general, you should be wary of what Task Manager is telling you. In this example, it doesn't make sense to me that memory could leak, because each of the (echo) processes is executing in a subshell, which terminates after completion. No matter what a process does in Windows, its memory is always returned when it terminates, unless it is doing something very unusual. (But, of course, cygwin's fork() does do something unusual...) You could try running some simple c++ program, after it looks like your memory is exhausted, to allocate 1 GB of memory, and see if it succeeds. When it returns, the OS will probably report more free memory. This was the basis of some scam-ish "RAM cleaner" programs that really didn't do anything other than make Task Manager's output look nicer. That said, you are also describing some real symptoms of a problem, such as exhausting the physical memory and swapping. That should not occur, so there may be some problem that's beyond my experience. (In your example, I would have said that maybe the disk thrashing you experienced was caused by find itself, but if you also see it just from running this subshell loop, that is strange.) I guess it could be something going wrong with fork(), etc, that someone else on the list might know about. They'll probably ask you to check all the usual suspects first... are there any firewalls, AV scanners, etc, running in the background? If so, try getting rid of all of them and see if the problem still occurs. There are some poorly written ones that have been known to interfere with cygwin. Hope that helps... -Lewis -- 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/