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: Sat, 21 Jul 2001 14:26:35 -0700 (PDT) From: Mo DeJong To: cygwin AT cygwin DOT com Subject: Re: Linking to cygwin1.dll and msvcrt.dll ? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Fri, 20 Jul 2001, Mumit Khan wrote: ... > > My question is, is this same memory leak problem going > > to show up when using Cygwin's CreateThread() and > > C library APIs? > > I believe the memory leak is only applicable if you're using MSVCRT > runtime, but that's not the case with Cygwin. The *ex functions close > the various handles and TLS' that are created per thread if I remember > correctly. The way I understood it, calling CreateThread() would not create the TLS block and a later call to a C api function might allocate the TLS block for you. Later on, you would call ExitThread() the the TLS block that was allocated would not be deallocated and the memory would leak. > > Even if this is not going to be a problem, should > > Cygwin provide the _beginthread, _beginthreadex, > > _endthread, and _endthreadex methods to ease > > porting existing apps that have already dealt > > with this issue? > > It's tempting, but IMO Cygwin should stay away from creeping feature'ism > such as this. Most of the threaded applications I see tend to use Win32 > API directly, and Cygwin of course supports that just fine. Of course, we > can always have msvcrt helper/port library that can facilitate ports. If the app uses only the Win32 API then I don't think this problem shows up. It only applies when a thread created with CreateThread() calls C APIs. I don't even know if this is a problem in Cygwin since as far as I know Cygwin does not implement C function is the same way as msvcrt.dll. I am not in a position to judge "creeping feature'ism". It is just that these 4 *ex methods are documented and are even suggested in the Microsoft documentation. If this memory leak is not a problem in Cygwin, then these functions should be really easy to implement since they would just call the Win32 APIs. cheers Mo -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/