Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Mon, 4 Jun 2001 00:19:31 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Cygwin handle leak in net.cc Message-ID: <20010604001931.A15105@cygbert.vinschen.de> Mail-Followup-To: cygwin AT cygwin DOT com References: <000701c0ec66$68034d00$4c93a5d8 AT msrv> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <000701c0ec66$68034d00$4c93a5d8@msrv>; from jdhagen@chorus.net on Sun, Jun 03, 2001 at 02:50:12PM -0500 On Sun, Jun 03, 2001 at 02:50:12PM -0500, Joe Hagen wrote: > The functions recv/recfrom and send/sendto use > the wsock_event class that obtains a handle using > WSACreateEvent. > > wsock_event::prepare allocates the handle. > > When this class is used, if wsock_event::wait isn't > invoked, the handle won't be freed. > > I observed this in the recv function. > > In Windows NT's Task Manager, I was watching > fetchmail's handle count, and it quickly grew to 60,000. > I modified the fetchmail source to obtain its handle > count using NtQueryInformationProcess from NTDLL.DLL, > and recv() was the culprit. > > If the wsock_event class was modified with a destructor > that did this: > > wsock_event::~wsock_event > { > if (event) > { > WSACloseEvent(event); > event=0; > } > } > > I think this would fix the problem. Thanks for the hint. I added a destructor. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin AT cygwin DOT com Red Hat, Inc. -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple