This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
Re: Windows HANDLE resource leak on pthread_create
- From: Dominic Gamble <dominic at advancen dot com>
- To: pthreads-win32 at sources dot redhat dot com
- Date: Wed, 19 Jan 2005 19:26:14 +1100
- Subject: Re: Windows HANDLE resource leak on pthread_create
- Organization: Advancen Software Solutions & Multimedia
- References: <1105945284.31190.3113.camel@watson>
- Reply-to: dominic at advancen dot com
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