From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4240 invoked by alias); 19 Jan 2005 08:28:37 -0000 Mailing-List: contact pthreads-win32-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sources.redhat.com Received: (qmail 3907 invoked from network); 19 Jan 2005 08:28:18 -0000 Received: from unknown (HELO volta.advancen.com) (203.89.236.175) by sourceware.org with SMTP; 19 Jan 2005 08:28:18 -0000 Received: from localhost (localhost [127.0.0.1]) by volta.advancen.com (Postfix) with ESMTP id C0B994400770 for ; Wed, 19 Jan 2005 08:03:23 +1100 (EST) Received: from watson.advancen.nat.com (adsl-22-138.swiftdsl.com.au [218.214.22.138]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by volta.advancen.com (Postfix) with ESMTP id 47B494400751 for ; Wed, 19 Jan 2005 08:03:23 +1100 (EST) Subject: Re: Windows HANDLE resource leak on pthread_create From: Dominic Gamble Reply-To: dominic@advancen.com To: pthreads-win32@sources.redhat.com In-Reply-To: <1105945284.31190.3113.camel@watson> References: <1105945284.31190.3113.camel@watson> Content-Type: text/plain Organization: Advancen Software Solutions & Multimedia Message-Id: <1106123174.31190.3196.camel@watson> Mime-Version: 1.0 Date: Wed, 19 Jan 2005 08:28:00 -0000 Content-Transfer-Encoding: 7bit X-SW-Source: 2005/txt/msg00003.txt.bz2 Thanks for those who responded. It seems I have to create the thread as detached initially. Cheers, Dominic. On Mon, 2005-01-17 at 18:01, Dominic Gamble wrote: > I have some code which creates a new thread every second or so, which > sends a windows message using (SendMessage) and then exits. > > I use pthread_create to create the thread. I use pthread_exit at the end > of my function. > > When the program is running the handle count in the windows task manager > seems to increase continually. The rate is approximately 800 handles > every 10 minutes (The thread count is stable though). I took out the > "SendMessage()" call in case it had anything to do with that but the > problem persisted. > > I then changed my code to use a basic Win32 API thread using > "CreateThread(...)". > > The handle count is now stable. > > I'm using the 2003-09-18 Snapshot, however I've read through the change > logs since then and there doesn't appear to be anything relating to a > resource leak on windows Handles. There is a mention of this being fixed > in the 2000-08-10 Snapshot, in the Bugs Fixed section: > > "Win32 thread handle leakage bug" > > Also in the 2003-08-15 Snapshot it says: > > "* POSIX thread handles are now reused and their memory is not freed on > thread exit. This allows for stronger thread validity checking." > > Can someone please verify that what is happening is a bug, as it appears > to lock up the entire system once the Handle Count reaches a certain > amount. I couldn't find anything about this on the Known Bugs page on > the website. > > FYI: This happens both on Windows 2000 & XP. > > Cheers, > Dominic