Ticket UUID: | 442646 | |||
Title: | Close Windows handle from _beginthreadex | |||
Type: | Patch | Version: | None | |
Submitter: | mdejong | Created on: | 2001-07-19 02:14:06 | |
Subsystem: | 49. Threading | Assigned To: | hobbs | |
Priority: | 5 Medium | Severity: | ||
Status: | Closed | Last Modified: | 2001-07-25 02:49:59 | |
Resolution: | Accepted | Closed By: | mdejong | |
Closed on: | 2001-07-24 19:49:59 | |||
Description: |
The documentation for the _beginthreadex method indicates that the caller is responsible for closing the returned HANDLE object. Tcl does not close this handle which seems like a memory leak to me. The following patch should fix the problem, but if someone that knows a bit more about Windows threads could take a peek I would feel much better about it. The part I am unsure of is if it is ok to call CloseHandle() on a thread handle that is currently alive. Here are some related URLs: http://support.microsoft.com/support/kb/articles/q132/0/78.asp http://technology.niagarac.on.ca/courses/comp831/win32/_beginthread.htm http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_crt__beginthread.2c_._beginthreadex.asp http://www.microsoft.com/msj/0799/win32/win320799.htm 2001-07-18 Mo DeJong <[email protected]> * win/tclWinThrd.c (Tcl_CreateThread): Close Windows HANDLE returned by _beginthreadex since the MS documentation states that this handle is not closed by a later call to _endthreadex. | |||
User Comments: |
mdejong added on 2001-07-25 02:49:59:
Logged In: YES user_id=90858 Ok, I am adding this patch since it does not change any of the test results and should plug a memory leak. hobbs added on 2001-07-25 02:02:17: Logged In: YES user_id=72656 Sorry, at the conference and right before makes things a little hectic for checking patches. Anyway, this looks correct to me. If it passes 'make test' on Windows with and without --enable-symbols, then I'd say put it in. mdejong added on 2001-07-24 11:43:08: Logged In: YES user_id=90858 Any reaction to this patch? It is kind of holding up another Cygwin patch so I if someone could take a look at it that would be great. I ran the tcl tests and the thread tests with this patch applied and I did not notice any ill effects. mdejong added on 2001-07-19 09:14:07: File Added - 8589: patch |
Attachments:
- patch [download] added by mdejong on 2001-07-19 09:14:07. [details]