Petr, You write: > -----Original Message----- > Subject: Possible resource leak > > I'm dealing with possible resource leak in cygwin on Windows-7. I'm > running a script which repeatedly calls another script (every 5 > seconds). After a while script ends with memory error. All my memory > seems to be eaten by Page Table entries and in the memory map I see a > lot of cygwin processes with 4 pages allocated (I can provide > screenshot > if neccessary). Is this known issue?
A few questions come to mind. Can you tell which processes are staying around? Use CYGWIN's ps(1); Window's Task Manager is likely to show only bash.exe. Are you sure that all of wget(1)'s resources have been freed before it gets invoked again? It surely uses things (IP stack, IP connections for example) that the Windows kernel manages. Similarly, sleep(1)'s main resource is interrupts, probably also eventually coming from the kernel. Perhaps there's a lock you should check (or create). You'll also be sleeping 0 seconds about every 5th cycle; maybe you should sleep $(( RANDOM%5 + 1 )) to make sure some sleeping always happens. Every call to fetchData.sh is another fork()/exec() which has to re-establish the definitions of getFileNoCheck() and getFileCheck(). It might be better to put everything into main.sh. Just some quick thoughts. It's always possible that there is something deep and subtle inside the CYGWIN DLL happening. (But I doubt it.)